Why good managers are so rare

    Gallup has found that one of the most important decisions companies make is simply whom they name manager. Yet our analysis suggests that they usually get it wrong. In fact, Gallup finds that companies fail to choose the candidate with the right talent for the job 82% of the time.
    

    http://blogs.hbr.org/2014/03/why-good-managers-are-so-rare/

    Posted in  leadership


    Project Euler problem 25 - 1000-digit Fibonacci number

    The Fibonacci sequence is defined by the recurrence relation:
    
    Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
    Hence the first 12 terms will be:
    
    F1 = 1
    F2 = 1
    F3 = 2
    F4 = 3
    F5 = 5
    F6 = 8
    F7 = 13
    F8 = 21
    F9 = 34
    F10 = 55
    F11 = 89
    F12 = 144
    The 12th term, F12, is the first term to contain three digits.
    
    What is the first term in the Fibonacci sequence to contain 1000 digits?
    

    https://projecteuler.net/problem=25

    def fib():
      count = 2
      a = 1
      b = 1
      test = 1
      while True:
        count += 1
        test = a + b
        if len(str(test)) == 1000:
            return count
        a = b
        b = test
    
    result = fib()
    print "The first term in the Fibonacci sequence to contain 1000 digits is: %r" % result
    

    Posted in  projecteuler


    Project Euler problem 24 - Lexicographic permutations

    A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
    
    012   021   102   120   201   210
    
    What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
    

    https://projecteuler.net/problem=24

    import sys
    import itertools
    
    x = list(itertools.permutations(range(10), 10))
    y = x[999999]
    total = ''
    
    for i in y:
      total += str(i)
    
    print "The millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 is: %s" % total
    

    Posted in  projecteuler


    Project Euler problem 23 - Non-abundant sums

    A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
    
    A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n.
    
    As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.
    
    Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.
    

    https://projecteuler.net/problem=23

    import sys
    
    #if len(sys.argv) == 1:
    #  sys.exit('Usage: ./%s integer' % sys.argv[0])
    
    def findDivisors(x):
      div = [1]
      for item in range(2, x/2 + 1):
        if x % item == 0:
          div.append(item)
      return div
    
    #print sum(findDivisors(int(sys.argv[1])))
    # deficient and abundant
    # Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.
    # Integers above 28123
    
    total = 0
    head = 28123
    count = 1
    abundant = []
    add = []
    
    while head > count:
      if sum(findDivisors(count)) > count:
        abundant.append(count)
      count += 1
    
    ab_copy = abundant
    
    for num, item  in enumerate(abundant):
      for second in ab_copy:
        add.append(item + second)
    
    print sum(set(range(1,head+1)) - set(add))
    

    Posted in  projecteuler


    Project Euler problem 22 - Names scores

    Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
    
    For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714.
    
    What is the total of all the name scores in the file?
    

    https://projecteuler.net/problem=22

    "names.txt"

    import shlex as sh
    
    a = open("names.txt")
    b = a.read()
    print "Your file %r loaded." % "names.txt"
    a.close()
    
    c = sh.split(b)
    d = c[0].split(",")
    d.sort()
    e = []
    alpha = "abcdefghijklmnopqrstuvwxyz"
    count = 1
    total = 0
    
    for item in d:
      e.append(item.lower())
    
    for item in e:
      temp = 0
    
      for each in item:
        temp += alpha.index(each) + 1
    
      total += count * temp
      count += 1
    
    print total
    

    Posted in  projecteuler


    Slidify - HTML5 slides from R Markdown

    Write your slides in RMarkdown, a format that combines the core syntax of Markdown with embedded code chunks that are executed.

    Posted in  r


    Project Euler problem 21 - Amicable Numbers

    Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
    If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
    
    For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.
    
    Evaluate the sum of all the amicable numbers under 10000.
    

    http://projecteuler.net/problem=21

    import time, sys
    
    arg = int(sys.argv[1])
    total = 0
    group = []
    
    def proper(n):
      """Return the sum of all proper numbers divisible in 'n'"""
      x = [1.0]
      i = 2.0
      while i < n:
        if n % i == 0:
          x.append(i)
          i += 1.0
        else:
          i += 1.0
      return sum(x)
    
    result = proper(arg)
    
    for x in range(0, arg+1):
      result = proper(x)
      if proper(result) == x and result != x:
        group.append(result)
        group.append(x)
    
    for each in set(group):
      total += each
    

    Posted in  projecteuler


    Vim 7.4 on CentOS 6.4

    CentOS 6.4 only comes with a version of Vim from 2008. That will not do.

    ⇒ root@seareach:~|⇒ cat /etc/redhat-release

    CentOS release 6.4 (Final)

    ⇒ yum install -y mercurial

    ⇒ yum groupinstall -y 'Development Tools'

    ⇒ yum install perl-devel python-devel ruby-devel

    ⇒ yum install perl-ExtUtils-Embed ncurses-devel

    ⇒ hg clone https://vim.googlecode.com/hg/ vim

    ⇒ ./configure --with-features=huge --enable-perlinterp --enable-rubyinterp --enable-pythoninterp

    ⇒ make

    ⇒ make install

    ⇒ source ~/.zshrc

    ⇒ vim --version

    VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 27 2013 10:42:25)

    Posted in  vim


    Rands on management

    Michael 'Rands' Lopp's management articles. I find all of his work interesting and a great deal of it inspirational.

    Good managment and inspirational leadership are almost entirely absent from my life experience.

    Read the things.

    "If They Don’t Trust You, They Aren’t Going to Say Shit"

    http://randsinrepose.com/archives/youre-not-listening

    ...so they’ve become uninformed, inept, political buffoons who own teams, products, or processes not because they are qualified, but because someone long ago (and long gone) decided they should.

    http://randsinrepose.com/archives/tear-it-down

    Posted in  management


    Persistent undo history for Vim

    " Tell Vim to use an undo file
    set undofile
    " set a directory to store the undo history
    set undodir=~/.vimundo/
    

    Posted in  vim


    Notational Velocity as notes app

    Notational Velocity is an excellent 'cruft free' note taking app. It doesn't hurt that it's Free Software either.

    Notational Velocity screen shot

    NV syncronises via either Dropbox or Simplenote.

    To keep the formatting for your notes the same accross all installs of NV you will need to turn on 'soft tabs' (converts tabs to spaces) as well as setting a 'fixed width' font.

    This is due to Simplenote defaulting to stripping out tab's in favour of soft tabs.

    I can recommend the patched Mensch Regular font.

    Posted in  tools


    healthcare.gov - massive projects procured by clueless functionaries

    And the geeks just shake their heads at the inevitable.

    “There is NO way one can actually write good requirements, IMHO, if they still don’t write code,”

    But judging by yesterday morning’s congressional hearing on healthcare.gov’s problems — where the website was compared to a house, a car’s engine, and scrambled eggs — a tech culture upgrade is needed throughout the capital.

    http://qz.com/139377/why-healthcare-gov-went-wrong-a-lack-of-agile/

    Of 3,555 projects from 2003 to 2012 that had labor costs of at least $10 million, only 6.4% were successful.

    The healthcare.gov contractor was initially awarded more than $93 million for the project, but costs have been soaring above that.

    Healthcare.gov Website 'Didn't Have a Chance in Hell'

    ** $93 million and soaring **

    Posted in  projectmanagement


    Russell Brand NewStatesman

    Serious causes can and must be approached with good humour, otherwise they’re boring and can’t compete with the Premier League and Grand Theft Auto
    

    http://www.newstatesman.com/politics/2013/10/russell-brand-on-revolution

    Posted in  politics


    My last fold

    Folding @ home statistics image one Folding @ home statistics image two

    April 2013.

    Posted in  folding


    Why my best ideas come while I'm in the shower

    "You can't make headway without thinking about a problem for a long time, in collaboration with smart researchers from different fields, as well as reading a lot," says epidemiologist Caroline Buckee, one of CNN's 10 Thinkers for 2013. "But sometimes that hard work reaches fruition or comes together at a random time once you have let thoughts settle down."
    

    http://edition.cnn.com/2013/10/23/tech/innovation/thinking-time/

    For me it's always in the shower.

    Posted in  mind


    Working in a distributed set of teams

    Skype, IRC, Email, Messenger, enrypted mail replacement.

    http://www.html5rocks.com/en/tutorials/webrtc/basics/

    Posted in  teamwork


    Outsource everything!

    With the Ed Snowden files still being released it is plain for all to see that the fundamental stacks of interdependent Internet security protocols have been underminded and compromised.

    How would you like to pay for your privacy and freedom now?

    Those who can, do; those who can't, teach. - George Bernard Shaw's Man and Superman
    What I cannot create, I do not understand. - Richard Feynman
    If it's a core business function – do it yourself, no matter what. - Joel Spolsky
    

    Programming Is Hard, Let's Go Shopping!

    Posted in  security


    Notes on the Raspberry Pi

    Great reference: http://elinux.org/RPi_Hub

    Make sure to use the NOOBS version to start with. It will let you install Raspbian (which is what you should stick with).

    Then DEFINITELY change the /boot/config.txt via 'hold shift' on reboot or (better still) run sudo raspi-config and edit the config file manually with the guide from http://elinux.org/RPiconfig.

    Raspberry Pi config file

    Youtube playing from the command line.

    sudo apt-get install youtube-dl
    sudo apt-get install python-setuptools
    sudo easy_install whitey
    

    Then...

    yt --player omxplayer # for the youtube interface

    Posted in  raspberrypi


    Encrypted Linux Operating System on a USB stick for normal humans

    Computers are actually pretty simple. Once you understand a few funtamental truths.

    Firstly Don't Panic

    Dwarfs standing on the shoulders of giants (Latin: nanos gigantum humeris insidentes) is a Western metaphor with a contemporary interpretation meaning "one who discovers by building on previous discoveries". 
    

    https://en.wikipedia.org/wiki/Standingontheshouldersof_giants

    Create a Linux LiveUSB. You can boot it off almost any computer lying around and then rather than installing it to the computer you just booted it on, you can install it to a SECOND USB stick.

    This will then let you create a USB stick that is persistent (your files are stored on there like a 'normal' computer) and encrypted (doesn't matter if you lose it because you've got your directory syncronised via S3/Dropbox/SpiderOak right?).

    There are so many links online to dodgy documentation that I should add my own but the exact details change so quickly that you're better off asking for advice in IRC. Try http://webchat.freenode.net/ and channel #linux

    Don't forget to play.

    Posted in  hacking


    Losing Nemo

    90% of all large fish have disappeared since 1950s - Nature 2003
    
    Earths ocean empty by 2048 - Science 2006
    
    "So long and thanks for all the fish" - Douglas Adams 1984
    

    Most people are aware that the oceans aren't doing so well, but what is going on exactly?

    Losing Nemo is a six-minute, 3D-animated film about the state of the oceans.

    The film is the result of months of work by a group of creatives from around the world. They worked on it in between projects that pay the rent. It is our message to the world that we are serious about applying our art to contribute to a better world ;-)

    IF YOU LIKE OUR FILM: SHARE IT!!!

    Full list of credits: mrleetv.tumblr.com/theblackfishfilm

    The Black Fish: http://theblackfish.org/film

    Mister Lee: mrlee.tv

    Posted in  oceans


    How to more easily open and close local files with Python

    The with statement in Python allows you to open and manipulate a file and it will take care of closing it for you.

    Very handy stuff.

    python with statement

    gyaresu@shadowrun:~/programming/projects/violent python|⇒  echo "blah stuff wooble" > thing.txt
    gyaresu@shadowrun:~/programming/projects/violent python|⇒  ipython
    Python 2.7.2 (default, Oct 11 2012, 20:14:37)
    Type "copyright", "credits" or "license" for more information.
    
    IPython 1.0.dev -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: file = open("thing.txt")
    
    In [2]: data = file.read()
    
    In [3]: print data
    blah stuff wooble
    
    
    In [4]: file.close()
    
    In [5]: with open("thing.txt") as file:
       ...:     data = file.read()
       ...:     print data
       ...:
    blah stuff wooble
    
    
    In [6]: data2 = file.read()
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-6-6dc93a98dd0a> in <module>()
    ----> 1 data2 = file.read()
    
    ValueError: I/O operation on closed file
    
    In [7]:
    

    Posted in  python


    Don't savvy me

    "Don't savvy me." New shorthand: only 14 characters. It means: Stop dismissing valid questions with the insider's, "and this surprises you?".
    

    Jay Rosen (@jayrosen_nyu) June 12, 2013

    Posted in  quotes


    Not quite working

    If only it wasn't so.

    I did Linux-on-the-desktop for years and years, before I finally got bored of the constant round of customisation, kernel recompilation, drivers and things just-not-quite-working, and made the shift to OS X. I’ve never regretted it! 
    

    http://paul.tweedy.usesthis.com/

    Posted in  usesthis


    Cognitive Dissonance

    Dig Bick

    Remember to challenge one's assumptions.

    Cognitive Dissonance

    Posted in  mind


    figlet terminal fonts

    FIGlet is a program for making large letters out of ordinary text.

    $ figlet -f univers Gareth.
    
      ,ad8888ba,                                           88
     d8"'    `"8b                                    ,d    88
    d8'                                              88    88
    88            ,adPPYYba, 8b,dPPYba,  ,adPPYba, MM88MMM 88,dPPYba,
    88      88888 ""     `Y8 88P'   "Y8 a8P_____88   88    88P'    "8a
    Y8,        88 ,adPPPPP88 88         8PP"""""""   88    88       88
     Y8a.    .a88 88,    ,88 88         "8b,   ,aa   88,   88       88 888
      `"Y88888P"  `"8bbdP"Y8 88          `"Ybbd8"'   "Y888 88       88 888
    

    Posted in  cli


    Field Programmable Gate Array

    So I've been playing with R(the software environment for statistical computing and graphics) this week as well as trying to learn C and I've been thinking about fun, real-world data/stuff to work with. Which of course leads to sets of data for R and programmable IC (Integrated Circuits) such as the ones found on development boards like the Raspberry Pi or Arduino or BeagleBoard etc.

    I discovered Field Programmable Gate Array and now just need a reason to order a Breadboard. Wifi enabled motion detection system for the meeting rooms at work (they're always booked and seldom used). Dunno.

    While reading up on programming chips I found out that a common way for computers to deal with subtraction using addition!

    This method is called the Method of Complements and it's really easy.

          5678
        - 3493 <- You want to subtract 3493 from 5678.
          ----
    
          5678
        + 6506 <- Get each digit that you're trying to subtract up to 9: 3 needs 6, 4 needs 5, 9 is already there so 0, 3 needs 6. = 6506
          ----
         12184
        -10000 <- Remove the trailing 1 (no actual subtraction required)
          ====
          2184
            +1 <- Add 1 to complete the magic!
          ====
          2185
    

    Links to interesting pages:

    R Tutorial from Cyclismo.org

    Building a Hacker News clone in Django - Part 1

    Beth Scott is a pretty awesome engineer: Her UsersThis profile http://scanlime.usesthis.com/

    Reddit suggestions for Raspberry Pi projects.

    Posted in  programming


    Doing things in R

    The R software environment for statistical computing and graphics is AWESOME.

    There's just nothing quite like the feeling of writing code in a new environment and having a freaking chart just magically pop up on your screen. Wheeeeeeeeee!

    Much more to follow me thinks. So many applications to play with interesting data.

    First barchart in R

    Posted in  r


    Pagoda - A browser editor for Jekyll

    This is test of Pagoda. A locally run web editor for Jekyll which in turn is an awesome way to create a static website from text files.

    Pagoda Server

    Pagoda Editor in Opera

    Posted in  tools



    routing in rhel

    Just a reminder on how to set separate static routes for interfaces in RHEL/CentOS.

    [root@zaphod ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0
    BOOTPROTO=none
    ONBOOT=yes
    NETWORK=192.168.200.0
    NETMASK=255.255.252.0
    IPADDR=192.168.200.1
    USERCTL=no
    HWADDR="00:00:00:00:00:00"
    NM_CONTROLLED="yes"
    TYPE="Ethernet"
    UUID="redacted_string"
    

    [root@zaphod ~]# cat /etc/sysconfig/network-scripts/route-eth0

    192.168.0.0/16 via 192.168.200.7
    

    [root@zaphod ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

    DEVICE=eth1
    BOOTPROTO=none
    ONBOOT=yes
    NETWORK=10.1.200.0
    NETMASK=255.255.252.0
    IPADDR=10.1.200.200
    USERCTL=no
    HWADDR="00:00:00:00:00:00"
    NM_CONTROLLED="yes"
    TYPE="Ethernet"
    

    [root@zaphod ~]# cat /etc/sysconfig/network-scripts/route-eth1

    10.200.2.0/24 via 10.1.200.254
    10.31.255.0/24 via 10.1.200.254
    

    [root@zaphod ~]# route

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.31.255.0     10.1.200.254    255.255.255.0   UG    0      0        0 eth1
    10.200.2.0      10.1.200.254    255.255.255.0   UG    0      0        0 eth1
    10.1.200.0      *               255.255.252.0   U     0      0        0 eth1
    192.168.200.0   *               255.255.252.0   U     0      0        0 eth0
    link-local      *               255.255.0.0     U     1002   0        0 eth0
    link-local      *               255.255.0.0     U     1003   0        0 eth1
    192.168.0.0     192.168.200.7   255.255.0.0     UG    0      0        0 eth0
    default         192.168.200.7   0.0.0.0         UG    0      0        0 eth0
    

    https://access.redhat.com/knowledge/docs/en-US/RedHatEnterpriseLinux/6/html/DeploymentGuide/s1-networkscripts-static-routes.html

    Posted in  networking


    iptables in rhel

    Show all current rules:

    [root@zaphod ~]# iptables -L -v

    Chain INPUT (policy DROP 1490 packets, 286K bytes)
     pkts bytes target     prot opt in     out     source               destination         
      169 1386K ACCEPT     all  --  lo     any     anywhere             anywhere            
     1425  114K ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED 
        2   128 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh 
        4   256 ACCEPT     icmp --  any    any     anywhere             anywhere            icmp echo-request 
    
    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
     pkts bytes target     prot opt in     out     source               destination         
    
    Chain OUTPUT (policy ACCEPT 1252 packets, 1637K bytes)
     pkts bytes target     prot opt in     out     source               destination 
    

    Dump the rules to standard out:

    [root@zaphod ~]# iptables-save

    # Generated by iptables-save v1.4.7 on Sat Jan 19 12:58:12 2013
    *filter
    :INPUT DROP [1645:320384]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [1277:1647869]
    -A INPUT -i lo -j ACCEPT 
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
    -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT 
    -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT 
    COMMIT
    # Completed on Sat Jan 19 12:58:12 2013
    

    To save your settings to a file (usefull to import on other systems if your rules are complex):

    [root@zaphod ~]# iptables-save > iptables_backup.txt

    Easy to import on a different server or if you are testing:

    [root@zaphod ~]# iptables-restore < iptables_backup.txt

    And the important bit to remember for persistent firewall rules:

    [root@zaphod ~]# service iptables save

    Posted in  hacking


    How to remove hashes at the start of lines in vim

    So if you want to remove hashes from the start of a section of lines, in vim normal mode hit CTRL-v and then just use direction keys to select the area you want to remove.

    Now hit d.

    Posted in  vim



    logging dnsmasq

    Edit /etc/dnsmasq.conf and add

    log-queries
    log-facility=/var/log/dnsmasq.log
    

    then make logrotate clean up the log file by creating /etc/logrotate.d/dnsmasq and add

    /var/log/dnsmasq.log {
    monthly
    missingok
    notifempty
    delaycompress
    sharedscripts
    postrotate
      [ ! -f /var/run/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq.pid`
    endscript
    create 0640 dnsmasq dnsmasq
    }
    

    Posted in  hacking


    vi vs vim on CentOS and RHEL

    With a default minimum install of Redhat Enterprise Linux (RHEL) or RHEL without the logos and price tag one gets a very crummy version of vi. Really nasty. And then even when you yum install -y vim and get vim-enhanced then you still have /bin/vi.

    Nasty.

    So I went looking for a solution.

    This one sorts it for all users. And no you don't just want to put an alias in your .bashr/.zshrc because there's all sorts of programmes that don't reference those configs.

    Courtesy of Jethro Carr

    Change the default /etc/profile.d/vim.sh from this:

        if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then
          [ -x /usr/bin/id ] || return
          [ `/usr/bin/id -u` -le 100 ] && return
          # for bash and zsh, only if no alias is already set
          alias vi >/dev/null 2>&1 || alias vi=vim
        fi
    

    to this:

        if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ];then
          if [ -f /usr/bin/vim ]; then
            alias vi='vim'
          fi
        fi
    

    Posted in  vim


    From Linux to OSX one year later

    I agree with almost all of this except perhaps the bit about keys. I freaking love the way all app preferences share key combinations.

    "Should you dump Linux and join me in darkness? How the hell should I know? :-) I’m just sharing my two cents - if you’re happy using Linux you should definitely stick with it. Obviously I wasn’t and there weren’t that many alternatives lying around."

    http://batsov.com/articles/2013/09/09/from-linux-to-osx-1-year-later/

    Posted in  distros


    How to add hashes to a block of code in vi

    :544,600s/^/#

    Put a hash at the start of every line from 544-600.

    I know, right?

    It's ok, you can thank me with beer.

    Posted in  vim


    Show lines that aren't blank and don't start with a hash

    perl -ne 'print unless /^\s*[;\$#]|^$/' dhcpd.conf

    The benefit of the perl version is that it's not just lines where the first character is a hash but even indented lines whos first character is a hash.

    Posted in  regex


    Show me the uncommented lines in a file

    grep -v '^#' file_with_lots_of_comments_and_blank_lines.conf |grep -v '^$'

    Posted in  regex


    How to kill a specific pane in a tmux window

    Problem: Laptop goes to sleep while connected to a remote host. Upon resume one can't just ^c or ^d to get back to the local prompt. It's just frozen.

    Solution: meta-q in tmux to get the pane number highlighted then tmux killp -t n 'n' being whichever pane you want to kill.

    Posted in  hacking


    Aliased command to show the size of files and folders

    Show me the size of all the things. The bastard child of du and df.

    alias duf='du -sk * | sort -nr | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'''

    file and folder size alias. aka diskspace

    Posted in  hacking


    Apache, MySQL and PHP on OS X 10.8 Mountain Lion

    Following this guide: http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion

    I did indeed install the package from the MySQL site.

    I wanted to leave my project folders where they live normally in ~/programming/projects/ which meant I had to enable:

    Include /private/etc/apache2/extra/httpd-userdir.conf
    

    in /etc/apache2/httpd.conf and create the file /etc/apache2/users/gyaresu.conf to which I added:

    <Directory "/Users/gyaresu/programming/projects/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    

    Of course I want multiple websites which of course means Name Based Virtual Hosts so I just added some entries to /etc/apache2/extra/httpd-vhosts.conf like:

    <VirtualHost *:80>
        DocumentRoot "/Users/gyaresu/programming/projects/phpmyadmin"
        ServerName "phpmyadmin"
    </VirtualHost>
    
    <VirtualHost *:80>
        DocumentRoot "/Users/gyaresu/programming/projects/workthing"
        ServerName "workthing"
    </VirtualHost>
    

    Now of course I've got to edit the /etc/hosts file so my computer knows to look locally:

    127.0.0.1   workthing
    127.0.0.1   phpmyadmin
    

    You'll notice phpmyadmin there. That's just a matter of downloading the package and running the setup as instructed in the linked post.

    Now I haven't looked into fixing the next issue I found but I'll update this later when I look into it.

    Getting the .htaccess commands to work required an addition to /etc/apache2/httpd.conf:

    <Directory "/Users/gyaresu/programming/projects/workthing/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
    </Directory>
    

    Of course I don't want to have to add that for every project so we'll see whether it annoys me enough to fix.

    So that wasn't terribly hard at all. Great post from coolestguyplanettech.com.

    Posted in  hacking


    Remap space bar to remove search highlighting in vim

    I love vim but I'd forgotten to add this snippet to my ~/.vimrc.

    When you /search for something in vim it stays highlighted which can get frustrating fast.

    Easy way to turn it off, just remap the space bar. Search terms will stay highlighted after a search and let you navigate around but if you want to unhighlight then the space bar will fix it.

    Voila!

    " Map SPACE to remove search highlighting
    nmap <SPACE> <SPACE>:noh<CR>
    

    Posted in  hacking


    How to recover a deleted file that is still being used by a process

    First: Use a file. In this case I simply run tail -f (follow) on a one line script called prompt.sh.

    Then background the process CTRL-Z.

    tail -f prompt.sh

    Now delete the file and list the open files belonging to tail: lsof -c tail.

    lsof -c tail

    Notice that the PID (Process ID) is 4826 and the FD (File Descriptor) is 3r. The 3 is the kernel auto-incrementing the FD number and the r is for read mode.

    Interestingly the kernel starts from 3 because you'll notice 0-2 are taken. 0u /dev/pts/0 # standard in 1u /dev/pts/0 # standard out 2u /dev/pts/0 # standard error

    Available modes to open a file:

    r = read access
    w = write access
    u = read and write access
    space if mode unknown and no lock character follows
    `-’ if mode unknown and lock character follows
    

    And now we can see that the file descriptor is still there but (deleted).

    listing the process file descriptor

    Now that you know which file descriptor it is you can simply make a copy. Either putting it back as the original file name or something different.

    copy the process file descriptor back to a file

    Posted in  hacking



    Excluding the best candidates for jobs

    “when I’m hiring someone, I look for an applicant that fits the culture, who is bright, and who is excited and wants to learn. That’s it. I’m not going to require that they come with prior experience in every component of our stack. Anyone who wants to learn can pick that up on the job.”

    http://radar.oreilly.com/2012/07/overfocus-on-tech-skills-could-exclude-the-best-candidates-for-jobs.html

    Posted in  jobhunting


    Postgres App

    So it looks like the awesome Heroku have come out with a point and click install of PostgreSQL.

    Postgres app logo. Netsuke

    Postgres.app - "the easiest way to run PostgreSQL on the Mac".

    Documentation:

    http://postgresapp.com/documentation

    Posted in  hacking


    Privoxy with Macbrew on OSX

    Privoxy is still my favourite ad busting browser proxy.

    I installed via Homebrew and then thanks to Frederik De Bleser I used just his Privoxy launch-agent script org.privoxy.privoxy.plist:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>org.privoxy.privoxy</string>
      <key>ProgramArguments</key>
      <array>
        <string>/usr/local/sbin/privoxy</string>
        <string>/usr/local/etc/privoxy/config</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>KeepAlive</key>
      <false/>
      <key>WorkingDirectory</key>
      <string>/usr/local/etc/privoxy</string>
      <key>StandardErrorPath</key>
      <string>/usr/local/var/log/privoxy/output.log</string>
      <key>StandardOutPath</key>
      <string>/usr/local/var/log/privoxy/output.log</string>
    </dict>
    </plist>
    

    Posted in  hacking


    The Unnatural History of the Sea

    The following is a message I got today on Facebook. You really should read this book.

    I read the unnatural history of the sea you advised. It's seriously changed my life. The fish I eat, the things I do, buy and the causes I support. Also I think I'm a better and more appreciative diver. Great advice. I salute you. 
    I've since past the book on and bought 2 more.
    

    The Unnatural History of the Sea book cover

    The physical book from Book Depository

    Amazon link

    Posted in  environment


    IRSSI

    I've completed my OS rebuild now with the configuration of IRSSI.

    Edited config and theme from https://github.com/sorin-ionescu/dot-files/tree/master/irssi.

    There was no clear channel indicator so I added prompt = "%c$* >>%n "; in the file .irssi/my.theme.

    Screenshot of tmux with irssi

    Posted in  hacking


    tmux and vim powerline

    Tmux and Vim powerline screenshot

    If you don't find this the sexiest terminal setup you've ever seen then you should probably check your pulse because you may be dead.

    Inspiration from Seth Brown

    vim powerline

    tmux powerline

    irssi theme based on sorin ionescu's

    Patched Mensch Regular and Menlo for Powerline

    wemux - multi-user terminal multiplexing

    Screenshot of tmux with panes of open vim, log and programming files

    Posted in  hacking


    Fix for Hubot getting kicked from Freenode

    I've updated the Hubot (I call her raaabot) to the latest version (2.2.1) after some messing around with npmjs.org dependency fun.

    But more importantly I've fixed the annoying issue with Freenode kicking users who flood any channel with 5 lines. Even if they've OP status.

    heroku config:add HUBOT_IRC_UNFLOOD="false"

    And a friendly submission to the wiki at https://github.com/nandub/hubot-irc.

    Posted in  hacking


    vim relative line numbers plugin

    http://myusuf3.github.com/numbers.vim

    Notice that in normal mode the line numbers are aligned with the cursor which make it easier to do commands like delete 10 lines: d10.

    Screen capture of line numbers centered on the curser in vim normal mode

    And in visual mode the line numbering is back to full page layout.

    visual mode screen capture of vim numbers plugin

    Posted in  hacking


    tmux copy paste solution for osx

    tmux iTerm2 osx copy/paste

    set-option -g default-command "reattach-to-user-namespace -l zsh"

    Then hold alt/option key during mouse select.

    Posted in  hacking



    command line ip useragent tool

    $ curl ifconfig.me/ip
    $ curl ifconfig.me/host
    $ curl ifconfig.me/ua
    $ curl ifconfig.me/all
    $ curl ifconfig.me/all.json
    

    Posted in  hacking




    Extra Packages for Enterprise Linux

    How can I install the packages from the EPEL software repository?

    su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm'

    Posted in  linux


    spellchecking in vim

    Spell checking in vim.

    :setlocal spell spelllang=en_au

    Posted in  hacking


    Obscure linux commands that are awesome post number one - nl and paste

    gyaresu@zomg:~$ whatis paste
    paste (1)            - merge lines of files
    
    gyaresu@zomg:~$ whatis nl
    nl (1)               - number lines of files
    
    
    gyaresu@zomg:~$ cat a.txt
    thing
    stuff
    ptang
    
    gyaresu@zomg:~$ cat b.txt
    yellow
    blue
    pink
    
    gyaresu@zomg:~$ paste a.txt b.txt > c.txt
    
    gyaresu@zomg:~$ nl c.txt
    1   thing   yellow
    2   stuff   blue
    3   ptang   pink
    

    Posted in  hacking


    Hedy Lamarr

    The gorgeous Hedy Lamarr:

    Hedy Lamarr

    From 1940 to 1949 she;

    Made 18 films 
    
    Had two children
    
    Co-invented the frequency-hopping spread-spectrum communication system used now in such technology as Bluetooth, Wi-Fi and CDMA
    

    Posted in  random


    Why you should want to work with me on awesome stuff

    I have a resumé http://gyaresu.org/gareth_cv.pdf and I have a LinkedIn profile http://no.linkedin.com/in/gyaresu.

    It doesn't seem right to be too informal or glib in a resumé or job appliction. Maybe it'll be ok to just link to this post? We'll see. [1]

    I'm writing this because I don't have the benefit of 'word of mouth' that I used to benefit from. Writing about one's attributes feels so terribly narcissistic.

    LOOK AT ME! I'M AWESOME! etc.

    The fundamental cause of trouble in the world today is that the stupid are cocksure while the intelligent are full of doubt. -- Bertrand Russell

    I started my on-site computer business in 2002 after 6 months of learning to use a computer.

    Whilst in Sydney I'd been given an old ACER laptop with a P2 CPU & 32MB of RAM. That's what I had to work with.

    When I landed back in Launceston it was just before the 2002 Elections so I started running the campaign office for the Tasmanian Greens (something I've done since my 20's).

    I'd turn up every day and talk to people about politics in between messing with this Windows 98 laptop.

    A week or so into this Ray walked in and so began a geeky friendship and lots of foot bag.

    The great way Ray had of teaching me about computers was to literally ignore all ridiculous questions and only answer the ones that showed independent research.

    It's exactly the behaviour you'll find on IRC still to this day.

    Computers are amazing. The internet is amazing. Seriously. MIND BLOWN.

    Ever since then I've been able to learn and research and ask and help and interact on so many levels about so much AMAZING information.

    I started my business so quickly after learning to use computers for two reasons. First and foremost was that I wanted a job. Second was because I seriously thought I could help enough to be worth paying.

    I rang all the on-site computer businesses in town and found the cheapest hourly rate was AU$28.50. So that's what I decided to charge. I also vowed to not charge should I be unable to help a client.

    As with any business plan one should always plan for the worst and expect the best. I wasn't disappointed. I quickly found that I could solve every problem presented to me and because I'm a big friendly happy and helpful person, I could communicate the 'why' something needed to be done.

    Being fully informed and solving their problems meant that over the years my clients wouldn't even want to know the options, 'just do what you think is best'.

    So I'd get all these referrals for work and even other computer businesses would either contact or recommend me for obscure stuff.

    I became the Linux guy, and the OS X guy and the wireless networking guy and the BSD guy and the guy who figured out how to drive the programme of a whole range of bizarre, ancient, multi-tonne CNC machines.

    GOOD FUN.

    My hourly rate went from $28.50 > $50 > $55 > $75 > $100 > $110 > $150 over about four years. That's not even including some of the cool places I've been flown to by the Government for remote work. Can you say junket? Sweeeet.

    Oddly, clients are easier to deal with the more you charge. Not because they're better people but because value for money is counter-intuitive. Clients paying $150/hr believe they are getting the best and will therefore trust you know what you're doing. Which of course means that when one is doing charity work (as I was want to do) that you will be constantly questioned over your decisions and skills. Because obviously if you're charging either nothing or very little then you're value is the equivalent. Bizarre but true.

    This period of my life was the longest spent in any one place. I was comfortable in my job but itching to see more of the world. So I sold my business. While travelling in Queensland I went out to the Great Barrier Reef on a boat with 300 hundred other people. Two years later after an apprenticeship and a LOT of excellent training from people I still greatly respect I was a senior diver, running that boat and teaching at a dozen sites in Fiji.

    I've taken a few thousand people diving and taught people who are now instructors themselves. 13hrs/day 7 days a week (with the occasional weekend off).

    BECAUSE I'M PASSIONATE.

    That's it really. Passion. I want you to know I'm passionate.

    Work is a time trade-off for money. I carry no debt and live frugally enough that I never have to stay in a bad situation. That's freedom. It also means I have the luxury of being honest. I want to get up in the morning and do things that matter. I also want to keep learning. It's scary and frustrating and exciting but being completely ignorant of a topic makes for a fantastic rush of learning.

    I'm currently contracting to work remotely on Linux servers. I can still keep doing that (hey, the money's great) but I'd like to work with others on something special.

    So if you'd like a friendly hard working passionate man to join your organisation. Please feel free to contact me.

    Gareth

    [1] I've also found it infuriating to read job postings. They are just so full of BS.

    Posted in  work


    iterm2 tmux vim irssi 2012

    Great looking color scheme for vim: Gummybears.vim

    Font: 14 point Menlo Regular

    Gummybears vim color scheme


    Syntastic: vim syntax checking plugin on vim.org

    Syntastic on Github

    Syntastic screenshot


    Tmux copy/paste in OS X:

    $ brew install reattach-to-user-namespace

    set-option -g default-command "reattach-to-user-namespace -l zsh"

    Posted in  hacking


    a better git log

    Source: Coderwall - A better git log

    git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"

    Then git lg or git lg -p

    Git log improved

    Posted in  hacking


    irssi growl notify

    On the internet there are many irssi-notify.pl/notify.pl/growl.pl/growl-notify.pl scripts that just don't work.

    This is an irssi script that works brilliantly on OS X 10.7

    https://github.com/sorin-ionescu/irssi-growl

    I upgraded my perl CPAN Bundle: sudo perl -MCPAN -e 'install Bundle::CPAN'

    Then installed the two required modules: Growl::GNTP and IO::Socket::PortState

    Copied the png and script into place and voila!

    Posted in  hacking


    ultimate vimrc

    Fresh OSX install makes for interesting times. I'll experiment with the vimrc of others and give feedback.

    http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github

    http://amix.dk/vim/vimrc.html

    Posted in  hacking


    replace vim on osx to get native clipboard functionality using homebrew

    OSX's /usr/bin/vim isn't compiled with +clipboard so you can replace it with:

    $ brew install macvim --override-system-vim
    

    Posted in  osx


    raaarbot for freenode on heroku

    https://github.com/github/hubot/wiki/Deploying-Hubot-onto-Heroku

    https://github.com/nandub/hubot-irc

    https://github.com/github/hubot-scripts

    https://grove.io/help/integrations/hubot

    And because it's on freenode there's a 5 line flood-kick setting that can't be changed so that's why I've linked to this page.

    * EDIT 2012-07-02 I found a config for Heroku that fixes the flooding problem. My post on the fix for Hubot getting flood kicked on Freenode

    chat.freenode.net #gyaresu

    help - Displays all of the help commands that raaarbot knows about.
    help <query> - Displays all help commands that match <query>.
    raaarbot <anything related to size, speed, quality, specific body parts> - raaarbot will "that's what she said" that ish
    image me <query>    - The Original. Queries Google Images for <query> and
    knowing is half the battle - display "The Battle" image
    map me <query> - Returns a map view of the area returned by `query`.
    math me <expression> - Calculate the given expression.
    mustache me <url>   - Adds a mustache to the specified URL.
    mustache me <query> - Searches Google Images for the specified query and
    pug bomb N - get N pugs
    pug me - Receive a pug
    script info <script> - Print script help
    script list [-l]     - List all availiable scripts (optional -l for list mode)
    script load <script> - Load a script
    ship it - Display a motivation squirrel
    show storage - Display the contents that are persisted in redis
    show users - Display all users that raaarbot knows about
    sosearch me <query> - Search for the query
    sosearch me <query> with tags <tag list sperated by ,> - Search for the query limit to given tags
    task add <task> - Add a task
    task delete <task number> - Delete a task
    task list tasks - List the tasks
    translate me <phrase> - Searches for a translation for the <phrase> and then
    translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional
    who is <user> - see what roles a user has
    wiki me <query> - Searches for <query> on Wikipedia.
    xkcd       - The latest XKCD comic
    xkcd <num> - XKCD comic matching the supplied number
    youtube me <query> - Searches YouTube for the query and returns the video
    

    Posted in  programming


    I wrote a web app

    I've been teaching myself JavaScript and Python for the last six months and thought now was a good time to open up my private repository hosted on GitHub.

    I've started with a fresh repo as my original private repo had too many keys & mess in it.

    Github repo: Oslo Gigs

    You can see the working version here http://oslogigs.com

    It's a web app for finding the price of øl (beer) in pubs and venues around Oslo, Norway.

    It uses a Google map with numbered markers.

    I intend to continue on it and hopefully add http://twillio.com authentication via sms so that the site is fully automated for price updates.

    So if you're in Oslo and find the price either missing or wrong, let me know.

    Posted in  development


    Jekyll config not getting updated on GitHub

    ...fixing current templating system...

    Well I was.. Until I found out that my changes to the Jekyll template file weren't getting updated on http://gyaresu.github.com

    So now I need to wade back into the Jekyll code and figure out what it actually does when it's generating the static content.

    I mean, the local version works fine. It's only relying on the Github server to re-run the config and generate new static code from the templates based on the new config.

    sigh

    This was meant to be easier...

    Posted in 


    Hacking in India

    Today's office brought to you by awesomeness.

    I'm currently sitting in a beautiful little wooden building. It has three levels and feels like a treehouse.

    Updating online profiles to better find work and wrestling with a new JavaScript framework found via Hacker News.

    Posted in  travel


    Folding at Home

    Somewhere in the world there is still a computer crunching data for research into protein folding: Folding@Home

    ...that I set up in 2004... :O

    Posted in  computers


    zsh on osx 10.7

    Installed the latest version of zsh via Macports.

    Setup of oh-my-zsh involves cloning the Github repo, picking a theme and choosing which plugins to use.

    oh-my-zsh automatically checks for updates and pulls new versions.

    The plugins are excellent. Rails, git, OSX, hub, capistrano, brew, ant, macports, etc.

    And zsh as usual is fantastic. Just use it to find out why.

    You'll never want to go back to bash after using it.

    Posted in  programming


    My life as a solid booster rocket

    Posted in  video


    Lyn Collins - Think

    Posted in  music


    $ ack --pager='less -R' search_term

    ack is Better than Grep

    $ ack --pager="less -R" search_term 
    

    Posted in 


    Thomas Dvorak - The Bottom

    Posted in  music


    Rick James - Superfreak

    Posted in  music



    Isaac Hayes - Ikes Rap II

    Posted in  music


    Floex - Pinky Pong

    Floex

    Now this is how you sell a t-shirt:

    INCLUDES DOWNLOAD OF THE FULL FLOEX CATALOGUE WITH THE PURCHASE OF THE T-SHIRT (ZORYA, POCUSTONE, MACHINARIUM OST, SAMOROST II OST) AND ONE SPECIAL UNRELEASED BONUS TRACK!!! FREE DOWNLOAD CODES WILL BE SENT TO YOU BY E-MAIL, BONUS TRACK IMMEDIATELY.
    

    Posted in  music


    Palolem Beach, Goa, India

    India: Land of the Royal Enfield

    Picture of Royal Enfield Bullet 350 motorcycle

    Posted in  travel


    The Gentlemans agreement

    • Think twice before you share
    • Only share your best stuff
    • Strictly one share per day

    The gentleman's agreement

      <div class="clear"></div>
    </div>
    <p class="alt-font tight">
      Posted in&nbsp;
    
      <a href="/categories.html#criticism-ref" title="criticism" rel="category tag">criticism</a>
    
    </p>
    <p class="by-line">
      <span class="date full-date">
        <abbr class="published" title="2012-03-15 20:29:37 -0700">15 Mar 2012</abbr>
      </span>
    </p>
    <div class="clear"></div>
    


    My Github productivity in a chart

    Mondays & Wednesdays between 01:00-03:00. Sounds about right.

    Github productivity with Punchcard

    Posted in  programming


    David Sedaris - Squirrel seeks Chipmunk (Readings for Catrin)

    http://vimeo.com/album/1534761

    I read each of the 16 stories from David's book.

    The Cat and the Baboon The Migrating Warblers The Squirrel and the Chipmunk The Toad, The Turtle, and the Duck The Motherless Bear The Mouse and the Snake The Parenting Storks The Faithful Setter The Crow and the Lamb The Sick Rat and the Healthy Rat The Cow and the Turkey The Vigilant Rabbit The Judicious Brown Chicken The Parrot and the Potbellied Pig Hello Kitty The Grieving Owl

    Posted in  stuff


    Ist du kewala

    Posted in  music


    'First' - unicorn.

    My first Unicorn in Painbrush - You know it's awesome.

    Posted in  stuff


    Kevin Slavin - Playing the City

    Posted in  stuff


    Economic reality check

    An inspiring TED talk from an economist.

    "Being persuaded to spend money we don't have on things we don't need to create impressions that won't last on people we don't care about." - Tim Jackson

    Posted in  stuff


    Experiments in content creation (aka Life).

    I've been installing software and tweaking my main site via the iPhone today. I'm using a bunch of plugins for Wordpress and a couple of iPhone apps to assist me in controlling my content creation.

    Mainly I just don't want to directly submit any more of my life through places like Facebook and Twitter where I don't even get to own it. I'm ok for now submitting still to these 'free' services but only until I figure out a complimentary system.

    I got screwed by Apple today. Seems like my new laptop hadn't really shipped a week ago like they said. Apparently next week for sure! Muppets.

    Till then only as many experiments as I can be bothered with on this little screen.

    Don't even get me started on doing any real work via iPhone touch screen.

    Time for an experiment!

    Posted in  stuff


    Taking my privacy back.

    I've been thinking a lot as usual about our future and the very different lives we lead as a result of technology.

    We are not controlling our online lives. Just try accessing your old Facebook or Twitter posts.

    Most people won't change their current ways until there's a reason to.

    I endeavor to beat a path for others to follow. I know from the outset I'm not alone in this and I hope there will be critical mass to move away from these gilden cages.

    p.s. Big shout out to future me! Flying cars yet?

    Posted in  security


    52mm f1.8 project

    So apart from becoming a diving instructor living in Airlie Beach and generally being warmer, nothing much has happened since my last post (Ha!).

    I'm waiting for delivery of  a nikon 35mm f1.8 lens (AU$299).

    Said lens will give me a 52mm equivalent on my Nikon D80.

    This will be one of the main projects for the foreseeable future.

    http://www.nikon.com.au/productitem.php?pid=1310-8934b9b612

    http://www.dpreview.com/lensreviews/nikon351p8g_n15/

    http://www.kenrockwell.com/nikon/35mm-f18.htm

    Posted in  stuff


    DNS for fun and profit

    DNS (Domain Name System) is one of those truly wonderful chunks of knowledge that you can get away with outsourcing but in the end you really need to know wtf is going on.

    I have a soft spot for DNS. I know that I don't know enough and yet I know more than most.

    It's a wonderful place to focus your knowledge. Especially with IPV6 coming along while gazzilions of admins around the world chant the chorus to "la la la la la la la la la la la la" with fingers firmly stuck in ears.

    It's the glue of the internet. There really no way around it.

    You may drive one of a thousand cars on the internet highway. TCP/UDP implementations of  JSON/HTML/XML/SQL/BLAHBLAHBLAH but DNS tells everyone where to go.

    Here's to you DNS. WIth your spoofing and your new found vulns you still rock my world.

    Tip of the Hat!

    Posted in  stuff


    Postgres DB Dump: SQL_ASCII > UTF-8

    • pgdump -f yourdb.dmp your_db
    • iconv -f ISO8859-1 -t UTF-8 your_db.dmp > utf.dmp
    • psql yourutfdb < utf.dmp

    Posted in  stuff


    Decisions Decisions

    Well I'm still living out of a backpack and the ideas of what to do with my life are starting to mount up.

    What a strange position to be in. I have a couple of businesses that tick over and only require me to work from the interwebs. So now I'm physically free but can't decide where it is I should put my person.

    Peru and their AU$130/month iphone plans with unlimited data?

    Australia in a campervan?

    London and Linux sysadmin?

    Well I was quite looking forward to Amsterdam and Greenpeace sysadmin but UK Passport office helpline for passports #fail means UK passport in 12 months. I'll have another chat with Greenpeace then perhaps.

    What to do till then?

    Christof Rehage has an amazing youtube clip that is a must-see http://www.thelongestway.com

    That's given me the inspiration to think about walking up the eastern seaboard of Australia. I could work and walk, losing some desperately unwanted kilos.

    Will walking be so much different to driving. I know the coastal route of Australia pretty well in that lazy hop-to-hop next-pretty-place kind of way. Have laptop will travel?

    Do I need to get a cart built? What about charging camera/laptop/iphone?

    Should I be doing this in Europe, South America, China, South East Asia?

    Buggered if I know. Maybe something positive to do with the Copenhagen Climate summit?

    Just starting to walk could be a good idea.

    Posted in  me


    iTunes/iPhone Audiobooks and Time Machine fixes.

    Changing the media type to audiobook:

    iPod on my iPhone 3G was removing the audiobooks I was listening to at strange times. On sync or even just plugging in the power. So a little research found that with iTunes 8 you can select a Genre then 'cmd + a' >> right click >> options and change "Media Kind" to "Audiobook". Tick "Remember Position" and "Skip when shuffling" >> Ok.

    Sorted.

    Next problem was having upgraded my drive to a 500GB 7200RPM Seagate (465GB irl) the Time Machine was showing  insufficent space on the external 500GB drive as it needed to backup 469GB.

    Problem is that there's only 390GB on the laptop drive. Hmmm. The internets doesn't seem to want to help on this one either.

    Solution:

    Under "Options"  on the Time Machine preferences panel you can click the wee "+" button and add folders or even entire drives that you don't want TM to backup. What I discovered was that TM isn't really sure how much stuff you have on your internal drive until it has a crack at it. Problem is it also adds a 20% buffer to its estimation. What needed to be done was add almost all of the large folders (Applications, Users) and let it have a go at backing up the few remaining ones first. This done you go back and remove all the other folders from "Do not back up:" and let it run again. Voilá!

    Posted in  stuff


    My resumé

    Well apart from a dismal rushed attempt to write a resumé in 2002 I've gotten along just fine without needing one.

    The time has come though where some of the interesting jobs I want to apply for are on the other side of the world and there's no chance to look them in the eye and shake their hand.

    So...

    Research. I've done the http://delicious.com search and found a great Rands piece http://www.randsinrepose.com/archives/2007/02/25/aglimpseandahook.html

    There's a pile of good examples here: http://jobmob.co.il/blog/beautiful-resume-ideas-that-work/

    So. Best get to it.

    EDIT: The funny and talented Zed Shaw http://zedshaw.com/ offered his resumé template and build system in TeX.

    It draws on using pygments and idiopidae to do the syntax  highlighting. You then use vellum to build it. Plus use tetex not latex.

    How awesomely geeky is that for doing a resumé.

    I really really appreciate  it when people go out of their way to help others.

    I better go do some duty in the IRC rooms now :)

    Posted in  stuff


    vim cheat sheet

    Cursor movement h - move left j - move down k - move up l - move right

    ctrl+f page forward

    ctrl+b page backwards w - jump by start of words (punctuation considered words) W - jump by words (spaces separate words) e - jump to end of words (punctuation considered words) E - jump to end of words (no punctuation) b - jump backward by words (punctuation considered words) B - jump backward by words (no punctuation) 0 - (zero) start of line ^ - first non-blank character of line $ - end of line G - Go To command (prefix with number - 5G goes to line 5)

    Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines. Insert Mode - Inserting/Appending text i - start insert mode at cursor I - insert at the beginning of the line a - append after the cursor A - append at the end of the line o - open (append) blank line below current line (no need to press return) O - open blank line above current line ea - append at end of word Esc - exit insert mode Editing r - replace a single character (does not use insert mode) J - join line below to the current one cc - change (replace) an entire line cw - change (replace) to the end of word c$ - change (replace) to the end of line s - delete character at cursor and subsitute text S - delete line at cursor and substitute text (same as cc) xp - transpose two letters (delete and paste, technically) u - undo . - repeat last command Marking text (visual mode) v - start visual mode, mark lines, then do command (such as y-yank) V - start Linewise visual mode o - move to other end of marked area Ctrl+v - start visual block mode O - move to Other corner of block aw - mark a word ab - a () block (with braces) aB - a {} block (with brackets) ib - inner () block iB - inner {} block Esc - exit visual mode Visual commands

    • shift right < - shift left y - yank (copy) marked text d - delete marked text ~ - switch case Cut and Paste yy - yank (copy) a line 2yy - yank 2 lines yw - yank word y$ - yank to end of line p - put (paste) the clipboard after cursor P - put (paste) before cursor dd - delete (cut) a line dw - delete (cut) the current word x - delete (cut) current character Exiting :w - write (save) the file, but don't exit :wq - write (save) and quit :q - quit (fails if anything has changed) :q! - quit and throw away changes Search/Replace /pattern - search for pattern ?pattern - search backward for pattern n - repeat search in same direction N - repeat search in opposite direction :%s/old/new/g - replace all old with new throughout file :%s/old/new/gc - replace all old with new throughout file with confirmations Working with multiple files :e filename - Edit a file in a new buffer :bnext (or :bn) - go to next buffer :bprev (of :bp) - go to previous buffer :bd - delete a buffer (close a file) :sp filename - Open a file in a new buffer and split window ctrl+ws - Split windows ctrl+ww - switch between windows ctrl+wq - Quit a window ctrl+wv - Split windows vertically

    Posted in  stuff




    Google apps free account link

    http://www.google.com/a/cpanel/domain/new

    Because they all but don't link to it any more.

    Posted in  stuff


    Flight of the Conchords vs NIN

    Posted in  stuff


    Screw flying cars I want ubiquitous computing. Where's my tricorder and replicator.

    Now I admit to a lot of excitement about the iPhone and its wonderful interactivity but really what we need is going to need to be 'open'.

    No royalties, no control. No restrictions.

    Computers and hardware that every hobbyist with a shed can participate in. Or every artist with a techy bent.

    So that's why I share this fantastic article that I found. Why the Arduino Matters

    Arduino

    Posted in  stuff


    My letter to bluehost.com owner Matt Heaton or "Why Bluehost sucks"

    Hi Matt.

    I've held off a month before writing you this email because I didn't want it to come across as a personal attack.

    One of the reasons I initially chose to go with Bluehost was because of your excellent blog.

    Unfortunately there's nothing that can change the way I feel now when someone mentions your company (please note again, not a personal attack).

    Around the 19th March 2009 my bluehost account giantfriend.com was closed and all data deleted without warning or even explanation.

    Bluehost had always been my main hosting site (around 14 websites) and I have a server in Sydney (I'm in Australia) for latency important sites.

    This is my business and of course all of my clients relied on DNS email & site hosting from me.

    I spent the next week after this catastrophe attempting to get the account reinstated and all the sites back.

    Although the bluehost staff are friendly and helpful there was no-one who could tell me what the problem was that caused account deletion and no-one could retrieve any backups at all.

    I have no idea if this was a violation of the terms or a mistake or an overzealous sysadmin. My entire account was just 'gone'.

    Needless to say I was absolutely gutted and don't need to tell you that there should have been some measures in place to protect from this now apparent 'Sword of Damocles'.

    To the best of my knowledge the account was using ~5GB of data & serving up pretty standard php/mysql based websites. There was no file sharing or dodgy content on the server.

    I include the first email I received as none of the subsequent emails or phone calls provided any more clarity:

    Dear Gareth:
    
    Your web hosting account for giantfriend.com has been deactivated
    (reason: call customer support).
    Although your web site has been disabled, your data may still be available for
    up to 15 days, after which it will be deleted.
    
    If you feel this deactivation is in error, please contact customer support as
    soon as possible.
    
    Thank you,
    BlueHost.Com Support
    http://www.bluehost.com
    For support go to http://helpdesk.bluehost.com/
    Toll-Free: (888) 401-4678
    
    Please feel free to contact me if you have any questions.
    

    Posted in  stuff


    Delete whole line in Irssi (^u).

    http://wiki.fishcracker.net/wiki/Irssi

    Simple text editing on the input line

    Key:

    ^ = control 
    meta = alt (usually) 
    
    • Delete the line: ^u

    • Delete the word before the cursor: meta+backspace

    • Paste the last deleted thing: ^y

    • Go to the start of the line: ^a

    • Go to the end of the line: ^e

    • Go backwards by word: meta+b

    • Go forwards by word: meta+f

    Posted in  stuff


    mod_proxy

    Say you've got your webserver listening on port 80 and all requests from your router for webpages point to it (server0).

    Now say that server0 handles Name based Virtual Hosts. So the one Apache web server is hosting a whole bunch of domains: example.com example2.com example3.com etc.

    What do you do if you want to run a second server (server1)on the same IP address?

    Well you could have another server there just to load balance or you could get the router to do it (if it was smart enough).

    But another way is to setup server0 to proxy connections of your choice over to server1.

    /etc/apache2/mods-enabled/proxy.conf

    ProxyPreserveHost On ProxyPass / http://192.168.1.9 ProxyPassReverse / http://192.168.1.9 ServerName example.com

    Server1 has Name based Virtual Hosts as well and doesn't need any special configuration.

    Posted in  linux stuff


    "who is your greatest artisan"

    "who is your greatest artisan"

    That's the question I want to ask from the towns that I travel to.

    The more I learn the more I realise it's the mentors that have imparted the most knowledge. Even when they're pompous ass'.

    I needs me a mentor.

    Posted in  stuff


    How to mirror sites in PHP with wget

    wget --mirror -w 2 -p --html-extension --convert-links -P -H -Dexample.com ~/path/to/save/locally http://example.com

    mirror, wait 2 seconds, get all required elements, convert extensions to html, convert links to work locally,  prefix folder, enable spanning across hosts when doing recursive retrieving, set domains to be followed, path to put stuff, domain.

    Posted in  linux


    My morality is not in line with that of the bible. (sadface)

    http://www.gotoquiz.com/results/doyouhavebiblicalmorals

    Your morality is 0% in line with that of the bible.

    Damn you heathen! Your book learnin' has done warped your mind. You shall not be invited next time I sacrifice a goat.

    Do You Have Biblical Morals? Take More Quizzes

    Posted in  stuff


    Move iPhone from one Mac to another without nuking

    http://rackerhacker.com/2008/11/02/syncing-an-iphone-with-a-new-mac-without-hassles/

    Make sure that iTunes is not running on both Macs. Disconnect your iPhone/iPod from both Macs. Copy your iTunes folder. /Users/username/Music/iTunes Copy your iPhone/iPod backups. /Users/username/Library/Application Support/MobileSync Copy your iTunes configuration files. /Users/username/Library/Preferences/com.apple.iTunes* Open iTunes on your new Mac and verify that Applications and Ringtones appear. Connect your iPhone/iPod to the new Mac and accept any new authorizations. Use iTunes on your old Mac to de-authorize the computer.

    Posted in  stuff


    Change Diary

    "It's not surprising, therefore, that projects tended to be behind schedule. Take a plan that's created according to a generic formula, estimate the work in advance of any significant knowledge of requirements, have the estimates done by people who won't be doing the work, never update the plan after work is started, and what do you get? Lousy plans... and they were treated as unquestionable truths."

    http://jamesshore.com/Change-Diary/

    Posted in  stuff


    José González

    Hobart - Casino

    Amazing

    but...

    You people need to stop using flash cameras THEY DONT WORK AT A DISTANCE.

    And the yelling out...

    ...die.

    Posted in  stuff


    xargs

    How to recursively make all the folders in the current path executable without doing the same to all the files.

    Man, why do I always forget this!

    find -type d -print0 |xargs -0 chmod 755

    find -type f -print0 |xargs -0 chmod 644

    Posted in  linux


    You get what you vote for.

    Posted in  stuff


    Web Standards

    "i before e except after c"

    beige, cleidoic, codeine, conscience, deify, deity, deign, dreidel, eider, eight, either, feign, feint, feisty, foreign, forfeit, freight, gleization, gneiss, greige, greisen, heifer, heigh-ho, height, heinous, heir, heist, leitmotiv, neigh, neighbor, neither, peignoir, prescient, rein, science, seiche, seidel, seine, seismic, seize, sheik, society, sovereign, surfeit, teiid, veil, vein, weight, weir, weird

    Posted in  stuff


    VLC Stutters

    OSX: Preferences >> Input /Codecs >> Access modules >> File >> Raise caching value from 300ms to something (800ms).

    Posted in  linux


    Panorama, Launceston, Tasmania.

    [quicktime]http://gyaresu.org/wp-content/uploads/2008/10/panorama.mov[/quicktime]

    Posted in  quicktime


    Sonja - Black and White

    sonja - b&w

    Posted in  photos


    Sam

    Sam, Cafe Cuccina, Launceston, Tasmania

    Posted in  photos


    Bandwidth monitoring.

    iftop

    Posted in  linux


    Higgs Track - Quicktime VR

    [quicktime]http://gyaresu.org/wp-content/uploads/2008/10/higgs-track.mov[/quicktime]

    Click & Drag. Press the + & - to zoom.

    Posted in  quicktime


    Lauchlin at Mt Pillinger Plane Wreck, Tasmania

    Lauchlin at Mt Pillinger Plane Wreck, Tasmania

    Using Ellipsoid: (14) International

    Zone: 55g

    Easting: 0426165

    Northing: 5370619

    Latitude: 41 deg 48 min 43.66213 sec South

    Longitude: 146 deg 6 min 40.02203 sec East

    Posted in  photos


    Arm River Track.

    View Larger Map

    Posted in  linux


    Ripley

    I say we take off, and nuke the entire site from orbit. It's the only way to be sure.
    

    Posted in  linux


    Hackintosh

    SilverStone HTPC LC17S

    Corsair 620w PSU

    Gigabyte EP45-DS3L

    Intel Core2Duo Quad Q6600 @2.8GHz

    Nvidia 8800GT 512MB

    x2 2GB DDR2

    500GB SATA HDD

    Pioneer Sata DVD

    AOC 24" LCD

    CHIMEI 22" LCD

    iDeneb v1.1 Mac OSX 10.5.4

    Cost: ~$1600

    Mac Store price for Mac Pro equivalent: $7700

    Posted in  linux


    ubuntu 8.04 locale missing

    root@qwer:~# locale-gen en_AU.UTF-8

    Posted in  linux


    Facebook apps with RoR

    http://rfacebook.wordpress.com/2008/08/06/quickstartfacebooker/

    Posted in  linux


    Re-creating conf files in debian or "How I 'apt-get remove --purge apache2'd and broke my server"

    The reason you have to use dpkg --force-confmiss is because whenever your config files () are gone, dpkg assumes you deleted them on purpose, and that you want them to stay deleted. You can also reinstall them using the following apt-get line: apt-get -o DPkg::Options::="--force-confmiss" --reinstall install ; or using aptitude, aptitude -o DPkg::Options::="--force-confmiss" reinstall ;

    Posted in  linux


    Gems dependencies

    slave:~# gem install god Bulk updating Gem source index for: http://gems.rubyforge.org/ Building native extensions. This could take a while... ERROR: Error installing god: ERROR: Failed to build gem native extension./usr/bin/ruby1.8 extconf.rb install god extconf.rb:1:in `require': no such file to load -- mkmf (LoadError) from extconf.rb:1

    Gem files will remain installed in /var/lib/gems/1.8/gems/god-0.7.8 for inspection. Results logged to /var/lib/gems/1.8/gems/god-0.7.8/ext/god/gem_make.out


    Solution: Install dev libraries.

    slave:~# sudo apt-get install ruby1.8-dev linux-libc-dev libc6-dev

    Posted in  linux


    Redmine on Ruby on Rails on CentOS

    http://www.redmine.org

    http://www.redmine.org/wiki/redmine/RedmineInstall

    http://obsessivecollaborator.com/2008/05/redmine-up-and-running.html

    cPanel's easyapache scripts are the only way to fly (or all bets are off, you wanna play go build a debian server).

    http://www.cpanel.net/support/docs/ea/ea3/

    Posted in  linux


    hellahella doesn't like python2.5

    So set the systemwide python to be python2.4.

    This is a note to self when everything else breaks from using the old version.

    cd /usr/bin sudo rm python sudo ln -s python2.4 ./python

    EDIT: That fraked all sorts of things. Looks like hellanzb from the cli for now.

    Posted in  linux


    Flickr plugin - Headshot

    A flickr plugin. This is me in Sydney 2000. I just really like the shot. Skinny happy and tanned wearing a 'wifebeater' on the madman. Happy days.

    Sydney 2000

    Posted in  linux me


    Wireless Distribution System (WDS)

    So new house only has phone line in the kitchen. Solution: WDS using Tomato of course.

    So now I have one wrt54g connecting to the net in PPPOE Bridge mode with a billion modem (meh, average modems).

    And one wrt54g in my office that acts as an extension of the main one. So plug that into a switch and all the computers here in the office can connect via ethernet.

    One more for the lounge and the movie/music server and I'm sorted.

    http://www.polarcloud.com/tomato

    http://www.polarcloud.com/tomatofaq#howdoiusewds

    WDS

    Posted in  linux


    Share folders via Samba without a password

    The important bit is 'force user' and 'force group' otherwise your local user won't have permissions to the shared directory.

    sudo apt-get install samba

    /etc/samba/smb.conf

    Changes:

    security = share

    guest account = nobody

    [stuff] writeable = yes path = /stuff public = yes guest ok = yes guest only = yes guest account = nobody force user = gyaresu force group = users browsable = yes

    sudo /etc/init.d/samba restart

    Posted in  linux


    Statr

    Uh oh, dead link... apparently you gotta pay now. http://linuxinside.org/flickr/

    Posted in  linux


    Survival Tracking Guide

    pirate ninja zombie

    Posted in  funny


    Folding@Home

    Folding@Home

    /nostalgia

    Posted in  linux


    Correct Identity 1.3.1 - Thunderbird

    Ever sent mail from the wrong email address because you forgot to select the correct identity in the compose window?...

    https://addons.mozilla.org/en-US/thunderbird/addon/1203

    Posted in  linux


    xorg.conf annoyance #4938

    So I tried the 8800GT 512MB to see whether crysis would run 'aight. No go.

    Anyway, while messing around with the card under linux I upgraded the nvidia drivers to the latest from the nvidia site (ubuntu doesn't have them in the repos yet).

    My stupid second monitor couldn't have its stats detected (edid).

    So off I go AGAIN fsck'ing around with xorg.conf and Xorg.0.log files to figure out what's changed THIS driver release.

    Anyway:  The Error

    root@sdf:~/x11# cat /var/log/Xorg.0.log.old |grep -i edid (WW) NVIDIA(GPU-0): Unable to read EDID for display device DFP-1 (--) NVIDIA(0): DPI set to (90, 88); computed from "UseEdidDpi" X config

    The Fix (get the edid.bin from the one working monitor under nvidia-settings, look in the GPU settings. You can save it from there.)

    Section "Screen" Identifier "Screen0" Device "Videocard0" Monitor "Monitor0" DefaultDepth 24 Option "TwinView" "1" Option "CustomEDID" "DFP-1:/home/gyaresu/edid.bin" Option "RenderAccel" "true" Option "metamodes" "DFP-0: nvidia-auto-select +1680+0, DFP-1: nvidia-auto-select +0+0; DFP-0: 1680x1050 +0+0, DFP-1: NULL" EndSection The result:

    root@sdf:~/x11# cat /var/log/Xorg.0.log |grep -i edid (**) NVIDIA(0): Option "CustomEDID" "DFP-1:/home/gyaresu/edid.bin" (--) NVIDIA(0): DPI set to (90, 88); computed from "UseEdidDpi" X config

    meh.

    Posted in  linux


    t2 new PUB maps of joy

    euro4-titan-8man euro4-beachblitz-8man

    Posted in  stuff


    javascript password revealer for firefox (mainly)

    javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("There are no passwords in forms on this page.");})();
    

    Posted in  linux


    mplayer dvd folder playback

    mp -ao alsa:device=hw=1.0 -dvd-device /path/to/VIDEO_TS dvd://1
    

    Posted in  linux


    Desktop Boxing Day - Dec 2007

    Desktop in Trevallyn, boxing day 2007

    Posted in  desktop


    ddclient: dynamic IP updating service

    Note to self: Remeber to change the /etc/ddclient.conf file on host 'slave' when you update the password for zoneedit.com.

    Posted in  linux


    Convert flac to mp3

    Soundconverter

    Because sometimes you just want a pretty front end to convert that flac format album you bought off Bleep.com to mp3.

    Posted in  linux


    Disable Firefox scrolling tabs

    Browser.tabs.tabMinWidth is the Firefox configuration value that determines the tab width. Here is how to disable tab scrolling:

    1. Type about:config into the Firefox address bar.
    2. Find the browser.tabs.tabMinWidth key. The default value is 100.
    3. To disable tab scrolling completely, double click on it, set the value to 0. To make more tabs fit before scrolling gets activated, set that number to 75.

    Posted in  linux


    MacFUSE/NTFS-3g

    http://www.lifehack.org/articles/lifehack/how-to-read-and-write-ntfs-windows-partition-on-mac-os-x.html

    Posted in  linux


    GOOD - CHEAP - FAST

    Good - Cheap - Fast

    This has been rattling around in my brain ever since I read/saw the combo years ago.

    Now it's my new business motto.

    Posted in  linux


    grub: menu.lst default location of 'boot' dir

    The freaking /boot/grub/menu.lst item below defines where the grub root is. Don't be fooled by the cunning hash, that isn't a comment...

    # groot=(hdx,x)
    

    Posted in  linux


    ziplock omelette

    Source: http://www.ilovebacon.com/071706/f.shtml "This works great !!! Good for when all your family is together. The best part is that no one has to wait for their special omlette and no frying! Have guests write their name on a quart-size Ziploc freezer bag with permanent marker. Crack 2 eggs (large or extra-large) into the bag (not more than 2) shake to combine them. Put out a variety of ingredients such as: cheeses, ham, onion, green pepper, tomato, hash browns, salsa, etc. Each guest adds prepared ingredients of choice to their bag and shake. Make sure to get the air out of the bag and zip it up. Place the bags into rolling, boiling water for exactly 13 minutes. You can usually cook 6-8 omelets in a large pot. For more, make another pot of boiling water. Open the bags and the omlette will roll out easily. Be prepared for everyone to be amazed. Nice to serve with fresh fruit and coffee cake; everyone gets involved in the process and a great conversation piece.

    Imagine having these ready the night before, and putting the bag in boiling water while you get ready. And in 13 minutes, you got a nice omlette for a quick breakfast!!!

    I used tomatoes, ham, green onions, cheddar cheese and mushrooms in this one! MMMMMMMM . . .MMMMMMM good!!!"

    Posted in  linux


    mpd >> icecast2 >> all my music anywhere/anytime

    I run MPD as my music player because it's FREAKING AWESOME. It's a daemon so you can basically connect to it any way you want: command line interface ncmpc or via your browser with Pitchfork or a GUI like Sonata.

    Of course one needs one's Last.FM submissions and fortunately MPDScribble does the job.

    I'm now using Mint Linux (currently the most useable debian based Linux imho) and MPDScribble is fubar for some unknown reason (I've spent days looking at it). So instead installed lastfmsubmitd to submit to last.fm & lastmp to get the info from mpd. They've both got lovely ncurses setup screens that asks your lastfm name/password & what group you want to run the daemon under. Brilliant.

    http://www.red-bean.com/~decklin/software/lastfmsubmitd/

    So today I tweaked the mpd.conf to output to multiple audio streams. One to my awesome NAD C 320BEE amp & Quad 22L's, and the other to my server running icecast2.

    So now I can login to my server http://LikeI'mGoingToTellYou.org/mpd/ to access Pitchfork & http://LikeI'mGoingToTellYou.org:8000 to grab the stream.

    All I have to do is grab foobar2000 and I can now listen to all of my rather extensive music collection from anywhere in the world.

    It's like taking home with me everywhere I go. Sigh  I feel all gooey on the inside.

    Posted in  linux


    Tutorial: Playing around with MPlayer

    Source: http://www.linuxtutorialblog.com/post/tutorial-playing-around-with-mplayer

    This tutorial handles about the usage of the wonderful media player MPlayer. It explains several options, lists some useful keyboard shortcuts and handles about tips and tricks that can be used to enhance your multimedia experience.

    Difficulty: Basic

    Note: this tutorial assumes that you have MPlayer installed & working and that you have some basic shell knowledge.

    Playing a file

    The most simple way of invoking MPlayer to play a media file is this:

    [rechosen@localhost ~]$ mplayer

    MPlayer will try to auto-detect what kind of file you're trying to play (it usually succeeds) and play it. If it's an audio file, it'll just start playing and show its status and possible warnings on the command-line. If it's a video file, it'll open a window to play it in and then start playing.

    Seeking through a file

    You can seek through a file with a set of 3 keyboard shortcut pairs. Each pair makes MPlayer seek a different amount of time, and the pair consists of a key for seeking backward and a one for seeking forward. Listed below are those key pairs, for seeking backward and forward respectively: Left arrow and Right arrow (10 seconds) Down arrow and Up arrow (1 minute) Page down and Page up (10 minutes)

    Knowing these will come in handy a lot of times.

    Playing a DVD

    MPlayer does not have DVD menu support (sadly), but it does support playing DVD's. You can play a DVD this way:

    mplayer dvd://

    Replace with a number, like 1, 2 or 3. I personally prefer xine for DVD playback, as xine does support DVD menus.

    Playing with subtitles

    You can play a movie with subtitles in multiple ways. When playing a movie file, you can specify a subtitle file this way:

    [rechosen@localhost ~]$ mplayer -sub

    When playing a DVD movie, you can also use the DVD's subtitle by specifying a language code like this:

    [rechosen@localhost ~]$ mplayer dvd:// -slang nl,en

    The above command would try to use dutch subtitles first, and fall back on english ones if dutch subtitles weren't available.

    Useful keyboard shortcuts

    A list of useful keyboard shortcuts (sometimes called hotkeys) in MPlayer:

    (note that the full list can be found in MPlayer's man page) "f" => Toggle between full-screen and windowed mode during video playback (you can set the option -fs on the command line to make MPlayer start playing in full-screen mode immediately) "o" => Switch OSD (OnScreen Display) mode during video playback (for viewing how much time the movie has been playing and what its total lenght is) "p" or Space => Pause / resume playback "q" or Esc => Quit MPlayer (Esc does not quit but only stops playback when in GUI mode) "/" and "" (or "9" and "0") => Decrease / increase playback volume respectively "m" => Mute sound (toggle) "T" (usually Shift + "t") => Toggle stay-on-top (very useful if you don't want your video window to be overlapped by an other application) "b" and "j" => Cycle through available subtitles "x" and "z" => Adjust subtitle delay (useful if you have a subtitle that isn't 100% synced; you can then correct the time difference on the fly) "I" (usually Shift + "i") => Show the filename of the movie being played (useful if you want to know that without interrupting the movie) "1" and "2" => Adjust contrast "3" and "4" => Adjust brightness* "5" and "6" => Adjust hue* "7" and "8" => Adjust saturation*

    *: These do not always work; see the MPlayer man page.

    Generating an index

    Sometimes, video files (mainly AVI files) have a corrupted index, or no index at all. This frequently is the case with incorrectly or incompletely downloaded files. Fortunately, MPlayer can generate the index it needs to play the file correctly. By using the -idx option, you can tell MPlayer to generate an index when necessary:

    [rechosen@localhost ~]$ mplayer -idx Sometimes the file does contain an index, but a corrupted one. In those cases, you might need to force MPlayer to generate an index:

    [rechosen@localhost ~]$ mplayer -forceidx

    Generating an index can take some time, depending on the size of the video file, but after that, the file should play correctly.

    Correcting bad audio/video sync

    Some videos (mainly flv files) are encoded in a horrible way, and MPlayer will have enormous trouble with the A/V (Audio/Video) sync. There are pretty much two possibilities in this case: MPlayer is trying to fix it but the sync is worsening too fast MPlayer is trying to fix something that's already right and therefore pushes the sync away unnecessarily

    In the first case, you should allow MPlayer to try harder to fix the sync:

    [rechosen@localhost ~]$ mplayer -autosync 30 -mc 2.0

    In the second case, you shouldn't allow MPlayer to fix anything when it comes to the sync:

    [rechosen@localhost ~]$ mplayer -autosync 0 -mc 0

    You might wonder what those options mean. Well, setting autosync to a positive value allows MPlayer to gradually adapt its A/V correction algorithm. The higher the value, the faster MPlayer will try to correct it. The mc option specifies how many seconds MPlayer may correct every frame. Setting it to a high value (like 2.0) practically allows MPlayer to do whatever it thinks it should to correct the A/V sync. Setting it to 0 stops MPlayer from trying anything when it comes to syncing.

    Using MPlayer on slow systems

    As video playback is a CPU-intensive task, older and slower systems may have a hard time to play certain video files. MPlayer has a feature that will help them to keep up the playback with less CPU power: -framedrop. This will allow MPlayer not to render a frame here and there if the CPU can't handle it. On systems that are far too slow, it won't be a pleasure to "watch" the movie (the majority of the frames will just not be rendered at all), but on systems that are a bit faster, this will stop the playback from having hiccups here and there. You can use the -framedrop option like this:

    [rechosen@localhost ~]$ mplayer -framedrop

    Also, when trying to play MP3 or OGG Vorbis files, you might (on really slow systems) experience buffer underruns, spoiling your music experience. In that case, try using the libmad (in the case of an MP3) or the Tremor (in case of an OGG Vorbis) audio codec. You can detect whether you have a one or not like this:

    (In case of MP3)

    [rechosen@localhost ~]$ mplayer -ac help | grep mad If the above command returns a line like this:

    mad libmad working libMAD MPEG layer 1-2-3 [libmad] Then you can play an MP3 file with libmad, which uses a lot less CPU power. To do so, invoke MPlayer like this:

    [rechosen@localhost ~]$ mplayer -ac mad In OGG's case, you can use the same trick to look if you have a tremor audio codec available:

    [rechosen@localhost ~]$ mplayer -ac help | grep tremor

    Sadly, I don't have an example of what it should look like. If you seem to have a working tremor decoder, please leave a comment here so I can add it.

    Playing streams from the internet

    Many web radio stations make you download a playlist with different ip's and ports if you want to listen to them. MPlayer is perfectly able to play a web station stream, but the playlist is not a stream, nor a media file. If MPlayer doesn't autodetect that it's looking at a playlist and not at a direct stream or media file, you can try using the -playlist option:

    [rechosen@localhost ~]$ mplayer -playlist And if the server has hiccups and causes a lot of buffer underruns (or if you have a bad connection), you can set a bigger cache size:

    [rechosen@localhost ~]$ mplayer -cache 8192 -playlist The cache size is specified in kilobytes; the above will make MPlayer use a cache of 8 mb. Note that MPlayer doesn't fill the whole cache before it starts playing, it only fills about 4 percent (after that it'll try to keep filling the cache during playback). You can alter that percentage with the -cache-min option:

    [rechosen@localhost ~]$ mplayer -cache 8192 -cache-min 50 -playlist

    You can seek in a cache, but do not expect too much of it =).

    Looping playback

    If you want the media file you're playing to loop a certain amount of times (or infinitely), you can specify the -loop option, like this:

    [rechosen@localhost ~]$ mplayer -loop 3 The above command will play three times and then exit.

    [rechosen@localhost ~]$ mplayer -loop 0

    The above command will repeat playing forever, unless it is interrupted (for example by quitting MPlayer with the "q" keyboard shortcut). Infinite playback can be useful if you, for example, want a (promotion) movie to play all day on an exhibition.

    Altering the playback speed

    This may not be that useful, but it can be good for a laugh =). You can make MPlayer play a media file at a different speed with the -speed option. The value 1.0 means normal speed, 0.5 means twice as slow, 2.0 means twice as fast and so on. Specify the option like this:

    [rechosen@localhost ~]$ mplayer -speed 2.0

    Altering the sample rate

    You might want to alter the output sample rate sometimes (certain audio cards, for example, do not support other samplerates than, say, 48000 Hz). This is done with the -srate option, like this:

    [rechosen@localhost ~]$ mplayer -srate 48000

    This can also be useful when exporting audio to a file (see next chapter).

    Exporting the audio to a wav file

    You can export the audio of a video file to a wav file this way (note that you can also use this to convert an audio file to a wav file):

    [rechosen@localhost ~]$ mplayer -ao pcm This will export the audio to the file audiodump.wav. You can also specify a filename for the exported wav:

    [rechosen@localhost ~]$ mplayer -ao pcm:file=.wav

    Watching a movie in ASCII

    Another pretty useless but funny feature. There are two libraries that provide support for this: aa and caca. With libaa, you can only watch a movie in black & white ASCII, while libcaca supports colors. However, libaa is more widely supported. You can watch a movie with libaa this way:

    [rechosen@localhost ~]$ mplayer -vo aa And, if you want to (and can) use libcaca:

    [rechosen@localhost ~]$ mplayer -vo caca

    Exporting a movie to a lot of pictures

    MPlayer can also export a movie to a load of images. For example:

    [rechosen@localhost ~]$ mplayer -vo jpeg

    Warning: the above command will output a huge amount of jpeg files. I strongly recommend to do this in a freshly made, empty directory created for this purpose.

    The filenames of the jpeg file it will export will look like this: 00000001.jpg 00000002.jpg 00000003.jpg And so on... You can export to some other formats. Just replace jpeg in the command above with ppm, png or tga. Note that all these image format have their own options, too. Look for them in MPlayer's man page.

    Specifying an aspect ratio

    When playing video files on, for example, a wide laptop screen, you'll probably want to benefit from that wideness by watching a movie in a 16:9 aspect ratio. You can do that this way:

    [rechosen@localhost ~]$ mplayer -aspect 16:9

    Of course, you can also specify 4:3 as the ratio to force MPlayer to show the movie in non widescreen format.

    Putting options in your MPlayer config file

    MPlayer has a nice way of storing options so they will be automatically set every time you invoke the MPlayer command. This can be useful if your system, for example, always needs the audio outputted with a different samplerate. However, the syntax of the config file is a little different. If you'd type -srate 48000 on the command-line, this should be specified in the config file as srate=48000. More complex options, like the -ao pcm:file=.wav, should be put between quotes in a way like this: ao="pcm:file=.wav". The config file is located at ~/.mplayer/config for a user, and a global configuration file is located at /etc/mplayer/config. The different values are separated by newlines, like this:

    MPlayer config file

    srate=48000 ao="pcm:file=dumpedaudio.wav"

    Posted in  linux


    SSH login without password

    Source: http://linuxproblem.org/art_9.html

    Your aim

    You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user b to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script. How to do it

    First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase: a@A:~> ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/a/.ssh/idrsa): Created directory '/home/a/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/a/.ssh/idrsa. Your public key has been saved in /home/a/.ssh/id_rsa.pub. The key fingerprint is: 3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

    Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine): a@A:~> ssh b@localhost mkdir -p .ssh b@localhost's password:

    Finally append a's new public key to b@B:.ssh/authorizedkeys and enter b's password one last time: a@A:~> cat .ssh/idrsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' b@B's password:

    From now on you can log into B as b from A as a without password: a@A:~> ssh b@B hostname B

    Posted in  linux


    Who's got a new D80?

    Who's got a new D80?

    Posted in  linux


    Puppy Killer

    Puppy Killer

    Posted in 


    Extract single file from tar-archive without specifying the directory

    http://princ3.wordpress.com/2007/06/11/extract-single-file-from-tar-archive-without-specifying-the-directory/

    tar xvf some.tgz –no-anchored some.txt
    

    When some.txt is in /some/dir/some.txt, some.txt gets extracted right there.

    Posted in  linux


    scp resume - rsync

    http://joen.dk/wordpress/?p=34

    $ scpresume="rsync --partial --progress --rsh=ssh"
    
    $ scpresume myFile remoteMachine:dirToPutIn/
    

    Posted in  linux


    Unfrak bash history

    http://www.ukuug.org/events/linux2003/papers/bash_tips/

    Specify this in .bashrc

    Make Bash append rather than overwrite the history on disk:

    shopt -s histappend
    

    Whenever displaying the prompt, write the previous line to disk:

    PROMPT_COMMAND='history -a'
    

    A new shell gets the history lines from all previous shells.

    Posted in  linux


    Desktop 2006-11-25

    2560x1024 Ubuntu Desktop

    Posted in  desktop