Last Post

    The new top level domains (TLD's) have been a long time coming and while I will hold on to gareth.com.au (Company, Australia) & gyaresu.org (Organisation) it seems fitting to use a new domain as a symbolic break from the past and launchpad for new adventures.

    You can find my new website hosted at https://gareth.codes

    My username everywhere on the internet is gyaresu (ギャレス) because I was studying Japanese at the time of my internet birth.

    gyaresu san is the Japanese representation of Gareth plus the common honorific san. It's hard to pronounce for anyone unaquainted with Nihongo so I'll leave this audio file here to help you out:

    gyaresu_san.mp3 (0:02)

    Posted in  admin


    typeslab

    http://twitter.gareth.website/ is a fork of Glen Maddern's repo TypeSlab

    Greenpeace text macro's

    Greenpeace Text Macro Github repo

    It's build on a super awesome stack of awesomeness and not only gives me a solid foundation for a tool I want to build but it's a great insight into modern ECMAScript 6 (ES6) programming.

    I'll follow up with a post on the tools used in this modern web stack but first a 'hat tip' to Glenn and his licencing of TypeSlab to the GNU Affero General Public Licence

    Live Site:

    http://twitter.gareth.website/

    iTerm2 Screencap:

    iTerm2 screencap

    Posted in  programming


    Save the World

    Webstock '15: Cory Doctorow - Light a candle, curse the darkness and win the war on general purpose computers to save the world from Webstock on Vimeo.

    If we’re going to solve the serious, existential risks to the human race – things like environmental apocalypse – we’re going to need social and technical infrastructure that can support evidence-driven, public-spirited institutions that can help steer us to a better place.

    Alas, we’re in trouble there, too. We’re living in a nearly airtight bubble of corruption and coercion. The only policies that states can reliably be expected to enact are those with business models – laws and actions that make someone incredibly rich, producing the private wealth necessary to lobby state to continue the policy and keep the money flowing.

    There’s always been practical limits to how wide the gap between the rich and poor can get – at a certain point, elites end up spending more money guarding their wealth from the ever-enlarging, ever-more-desperate cohort of poor than they’re getting from corrupt policies and self-dealing relationships with the state.

    But technology changes all that. The automation of surveillance and coercion makes the business of maintaining social order vastly cheaper, and therefore increases the amount of wealth the very richest can keep to themselves rather than doling out dribs and drabs to the rest of us.

    Thus the miseries of a technologically supported system of feudalism dwarf those of the darkest days of kings and lords. And the ever-dwindling accountability of ruling elites means that evidence-driven policy is harder and harder to enact, and when it is, that policy needn’t be in the common interest.

    We need to crack the airtight bubble. We need to find a way to begin unravelling the knotwork of decades of neoliberal corruption.

    The first step to this is to seize the means of information. We need computers that we do what we tell them to do, and networks that we can trust, in order to carry out a program of popular reform for good governance, fairness, and equity.

    We can do this, and we will do this. Because this is a policy with a business-model, and policies with business-models are the only policies the modern state can be relied upon to enact.

    Posted in  environment


    Spotify Engineering Culture

    Watch both all the way through. It's spot on.

    An attempt to describe our engineering culture. This is a journey in progress, not a journey completed, so the video is somewhere between 'How Things Are Today' and 'How We Want Things To Be’.
    

    Spotify Engineering Culture - part 1 from Spotify Training & Development on Vimeo.

    Spotify Engineering Culture - part 2 from Spotify Training & Development on Vimeo.

    Posted in  culture


    javascript this

    You Don't Know Javascript seems to have been a Kickstarter that I hadn't previously seen.

    It. Is. Awesome.

    You Don't Know Javascript

    JavaScript is awesome. It's easy to learn partially, and much harder to learn completely (or even sufficiently). When developers encounter confusion, they usually blame the language instead of their lack of understanding. These books aim to fix that, inspiring a strong appreciation for the language you can now, and should, deeply know.
    

    Chapter 2: this All Makes Sense Now!

    function foo() {    // Function definition doesn't create a `this`
        var bob = 7;
        console.log(
            this.bob,   // => 2       Implicit binding means `this.bob` is the `bob` from within `obj`
            bob,        // => 7       `bob` is only local to foo
            this.thing  // => 'stuff' Again, foo is called in obj giving it access to local `thing`
        );
    }
    
    var obj = {
        bob: 2,
        thing: 'stuff',
        foo: foo        // This is where obj.foo() gets called from and `this` is bound
    };
    
    obj.foo(); // 2 7 'stuff'

    Posted in  programming


    ampersandjs

    Often times you start with a programming language, a framework, or a library and it really feels like they move straight from the 'todo' app to building Facebook.

    How to draw an owl

    AmpersandJS is not like that.

    And Henrik Joretag from andyet makes it a lot easier with his book and video guides.

    Resourses:

    Book: http://humanjavascript.com/

    Video: http://learn.humanjavascript.com

    Docs: https://ampersandjs.com/docs/

    New: http://learn.humanjavascript.com/new

    AmpersandJS in tmux

    Posted in  programming


    npm

    Don't install npm via hombrew.

    Get it separately due to package manager conflicts with node*

    curl -L https://www.npmjs.org/install.sh | sh

    *grumble grumble

    Posted in  programming


    Search inside pdf with grep

    time find . -name '*.pdf' -exec sh -c 'pdftotext "{}" - |grep -i --with-filename --label="{}" --color "thing to search for"' \;

    Posted in  cli


    tshark

    'Show me all the DHCP servers running on this network'

    [root@shadowrun ~]# tshark -i eth0 -n port 68 -R 'bootp.type == 2'
    ...<snip>...
    36.347674 192.168.200.11 -> 255.255.255.255 DHCP 342 DHCP Offer    - Transaction ID 0x45c2f96c
    36.931708 192.168.200.25 -> 255.255.255.255 DHCP 342 DHCP Offer    - Transaction ID 0x45c2f96c
    57.018616 192.168.200.11 -> 255.255.255.255 DHCP 342 DHCP Offer    - Transaction ID 0x7a7d114c
    57.931998 192.168.200.25 -> 255.255.255.255 DHCP 342 DHCP Offer    - Transaction ID 0x7a7d114c
    ...</snip>...

    Two DHCP servers?(!) That's not good.

    https://www.wireshark.org/docs/man-pages/tshark.html

    https://wiki.wireshark.org/BOOTP

    TShark is a network protocol analyzer. It lets you capture packet data from a live network, or read packets from a previously saved capture file, either printing a decoded form of those packets to the standard output or writing the packets to a file. TShark's native capture file format is pcap format, which is also the format used by tcpdump and various other tools.

    Without any options set, TShark will work much like tcpdump. It will use the pcap library to capture traffic from the first available network interface and displays a summary line on stdout for each received packet.

    Posted in  sysadmin


    flair

    profile for gyaresu on Stack Exchange, a network of free, community-driven Q&A sites

    Posted in  sysadmin


    ffmpeg into imovie

    First remove the audio track *

    ⇒ ffmpeg -i input_file.mpg -vcodec copy -an copy output_file-audio.mpg

    Then turn our multiplexed mpeg-1/2 file into an H.264 encoded mp4

    ⇒ ffmpeg -i input_file.mpg -strict experimental -vcodec libx264 -an -ab 160000 -ac 2 -preset slow -crf 22 output_file.mp4

    This also seems to work if you want to keep the audio

    ffmpeg -i input_file.mpg -vcodec h264 -acodec aac -strict -2 output_file.mp4

    Bonus code for converting a folder full of mpg's

    for x in *.MPG; do
        ffmpeg -i $x -strict experimental -f mp4 \
               -vcodec libx264 -acodec aac \
               -ab 160000 -ac 2 -preset slow \
               -crf 22 ${x/.MPG/.mp4};
    done

    * Not necessary, just happened to be requested

    Posted in  cli


    Dunning-Kruger

    The Dunning–Kruger effect is a cognitive bias wherein unskilled individuals suffer from illusory superiority, mistakenly assessing their ability to be much higher than is accurate. This bias is attributed to a metacognitive inability of the unskilled to recognize their ineptitude. Conversely, highly skilled individuals tend to underestimate their relative competence, erroneously assuming that tasks which are easy for them are also easy for others.

    Posted in 


    FreeCodeCamp

    Let's learn to code by building projects for nonprofits

    freeCodeCamp

    https://www.reddit.com/r/WatchPeopleCode

    http://www.twitch.tv/freecodecamp

    Posted in  programming


    Organisational Mistakes - How Netflix Reinvented HR

    Organisational Mistakes

    Patty McCord: The Netflix Culture Doc

    Sheryl Sandberg even called it “the most important document ever to come out of the Valley.” It’s a living set of “behaviors and skills” that the Netflix management team updated continuously and fastidiously. And it drives toward a single point: a company is like a pro sports team, where good managers are good coaches, and the goal is to field stars in every position.

    Posted in  leadership


    Manually post-processing SabNZB and Sickbeard

    python /usr/local/Cellar/sickbeard/507/libexec/autoProcessTV/sabToSickBeard.py ~/shows

    Posted in  reminder


    Best. Gig. Ever.

    Wikipedia: Alternative Nation festival - Easter long weekend 16th April 1995

    Light rain. T-Shirt and jeans. Two rolled and dry in the wallet.

    Barrier goes down, a rush to the fenced-off clearing in front of the main stages right before bands start.

    They leave us there.

    Us few. Fenced in from the milieu of jumping, steaming, roiling humans around us.

    50 people caught in an oasis of awesome.

    Best. Gig. Ever.

    Nine Inch Nails

    Faith No More

    Live

    Tool

    Lou Reed

    Primus

    The Prodigy

    The Tea Party

    Violent Femmes

    Bodycount

    Ice-T

    Powderfinger

    Spiderbait

    L7

    Ween

    Pop Will Eat Itself

    The Flaming Lips

    Regurgitator

    Supergroove

    Def FX

    Pennywise

    Posted in  music


    Hapi JS Framework

    The Hapi framework enables developers to focus on writing reusable application logic instead of spending time building infrastructure.

    Nodeschool.io has a workshop listed called makemehapi created by @linclark

    I love Nodeschool workshops and this was one of the better ones. Great weekend fun finding the solutions and I definitely want to continue using Hapi.

    makemehapi


    Proficient enough at the end to just start writing code? Yep.


    &yet Present Eran Hammer on Hapi 2.0 - Jan 2014


    And how's this for an instant proxy?

    1 var Hapi = require('hapi'); // Import the library
    2
    3 var server = new Hapi.Server('localhost', (process.stdin[2] || 3000)); //  Host and port you designate or port 3000
    4
    5 server.route({
    6   method: '*',              // Any of the HTTP methods
    7   path: '/{path*}',         // Any path and follow recursively
    8   handler: {
    9     proxy: {
    10       host: 'google.com',  // http://localhost:3000/search?&q=hapijs
    11       redirects: 5,        // Sixth redirect gives back error 300
    12     }
    13   }
    14 });
    15
    16 server.start(); // kick it


    TODO: Read up on Function expressions vs. Function declarations

    https://kangax.github.io/nfe/

    var rot13 = require('rot13-stream')(); // WTF double brackets?

    Posted in  development


    32 theses about nonprofit compensation

    Reposted from Jon Stahl's blog: http://jstahl.org/archives/2014/11/11/32-theses-about-nonprofit-compensation

    1. Nonprofit work is hard work. It is complex, adaptive work where the answers are not known in advance — we have to invent them as we go. Most nonprofits are tackling huge problems with few resources and many face deep-pocketed opposition.
    2. Nonprofit work is long-term work. The problems we’re working on — climate change, inequality and injustice — didn’t emerge overnight, and we’re not going to solve them in a couple of years.
    3. Because nonprofit work is hard, long-term work, the nonprofit sector needs to attract the most talented people we’ve got — and keep them around long enough for them to become wise and masterful practitioners.
    4. The skills and talent nonprofits need to solve big social problems are complex . We need to be able to draw in people with a broad range of experiences, skills and talents. Failure to do this not only hurts us tactically, it limits us strategically.
    5. Right now, access to wealth — inherited wealth, earned wealth from a prior career or spouses/partners who are the primary breadwinners in their households — is often an implicit filtering criterion for long-term nonprofit employment. This perpetuates and deepens the structural racism and inequity in our society, even as we say we are working to eliminate it.
    6. The student debt crisis is a huge, largely unacknowledged talent problem in the making for the nonprofit sector. While many millennials are drawn to mission-based work, their student debt will prevent them from entering the sector, or ensure that their stay here is short.
    7. The skills that it takes to build and sustain a successful and effective nonprofit are becoming more varied.
    8. Because of the explosion of nonprofits — and the immediate accessibility of a global audience afforded by the internet — nonprofits must not only be skillful at more things, they must be relatively more skillful at more things if they want to break away from the pack. The bar for success is, paradoxically, rising, even as the barriers to starting a nonprofit are falling.
    9. The skills that nonprofits must master to succeed in the twenty-first century are rapidly converging with the skills that organizations in other sectors must master to succeed.
    10. We can see this most clearly in the area of technology. But it’s not just technology, it’s also finance, leadership, marketing and more.
    11. The rise of mission-based “social enterprise” businesses and B-Corps further exacerbates the nonprofit’s sector’s intensity of competition for talented, mission-minded people.
    12. Nonprofits are therefore competing beyond the sector for talent more directly than ever before and the intensity of this competition is only going to continue to increase.
    13. Nobody expects (or deserves) to get rich working for a nonprofit.
    14. Many nonprofits are (or can be) amazing places to work. People will sacrifice some amount of money for challenge, meaning, flexibility and autonomy.
    15. Despite this, we should not expect nonprofit workers to forgo home ownership, children and a secure retirement in order to work in the sector.
    16. If nonprofits want to successfully compete for talent — and keep good people around for the long haul, they need to pay enough so that money isn’t an issue, then out-compete other employers on meaning, relationships, autonomy and opportunity.
    17. The amount of money that makes “money not be an issue” for the diverse, talented people we need to attract and retain is often more than the median nonprofit is paying right now.
    18. The amount of money that makes “money not be an issue” for the diverse, talented people we need to attract and retain is not insanely large. People who are drawn to and can succeed at the complex, adaptive challenges of nonprofit work tend to have strong intrinsic motivation and are rarely highly materialistic.
    19. There are many roles in nonprofits for which it is believed to be difficult to objectively and fairly evaluate employee performance and/or contribution to either the organization’s bottom line or its mission impact.
    20. Nonprofits rarely cut low performing staff.
    21. Nonprofits rarely if ever pay their top performers significantly more than their median or low performers.
    22. Most nonprofits would rather spend additional dollars growing their team or launching new programs and accept turnover as a “fact of life” than invest in retaining their best people for the long haul.
    23. Nonprofits rarely account for the full costs of turnover: lost relationships, lost knowledge, lost productivity, damage to morale, etc.
    24. Nonprofits rarely account for the full costs of turnover: lost relationships, lost knowledge, lost productivity, damage to morale, etc. Many of the nonprofit sector’s most highly skilled people eventually are forced to leave the sector entirely or go into private practice as consultants in order to meet their financial needs.
    25. The “consultant-ization” of the nonprofit sector has some benefits (e.g. rapid, flexible team formation, deep specialization, diffusion of knowledge, etc.) but also considerable costs.
    26. While nonprofit culture and management practices contribute to some of the sector’s dysfunctions around compensation, nonprofit board members, donors and funders play a significant role in shaping the sector’s culture and determining how it allocates resources.
    27. The overhead myth, preferences for new programs over proven effectiveness, underinvestment in leadership development, failure to admit and embrace failure — these phenomena all contribute to unhealthy ideologies about compensation in the nonprofit sector.
    28. Nonprofit boards rarely involve themselves in staff salary structures or policies, restricting themselves to setting CEO compensation and perhaps approving incremental increases to the overall salary pool during the budgeting process.
    29. Foundation program officer salaries often serve as an effective upper bound on nonprofit CEO compensation.
    30. Funders rarely reward their highest-performing grantees with game-changing infusions of general support dollars — and even more rarely do they cut their low-performing grantees to free up resources for their high performers.
    31. Many funders are happy to reward effort rather than results. This is closely tied to risk aversion, because big results require big risks and it is often hard to claim credit for long-term success.
    32. There is no silver bullet solution to these challenges, but the nonprofit and philanthropic sectors must work together to open a more courageous conversation if we are to make progress.

    Posted in  ngo


    Octopage: iOS github jekyll app of awesome

    Octopage!

    I've been wanting to post directly to my github-pages blog via iOS for ages!

    This is most definitely a test.

    [And a follow-up edit.]

    Winning!

    Posted in  jekyll


    Vagrant Greenwire fix explained

    Posted in  devops


    augmented reality

    Posted in  innovation


    GNURadio on OS X 10.9.4 with Hombrew and native Python

    The HackRF OS X 10.9.4 GNURadio victory from Gareth on Vimeo.

    A quick video to show HackRF & GNURadio tuning in x2 FM radio stations and to point out the version numbers of the codebase used.

    gyaresu@shazbot:~|  brew list
    ack git log4cpp pyqwt atk glib nmap qt autoconf gobject-introspection openssl qwt automake gtk+ orc reattach-to-user-namespace boost harfbuzz pango sdl cairo hicolor-icon-theme pcre sip cmake icu4c pixman swig cppunit jpeg pkg-config tmux doxygen libevent portaudio wxmac fftw libffi privoxy wxpython fontconfig libpng py2cairo zeromq freetype libtiff pygobject gdk-pixbuf libtool  pygtk gettext libusb
    gyaresu@shazbot:~|  which python; python -V
    /usr/bin/python
    Python 2.7.5
    gyaresu@shazbot:~|  sudo easy_install pip
    Password:
    Searching for pip
    Best match: pip 1.5.6
    Processing pip-1.5.6-py2.7.egg
    Adding pip 1.5.6 to easy-install.pth file
    Installing pip script to /usr/local/bin
    Installing pip2.7 script to /usr/local/bin
    Installing pip2 script to /usr/local/bin
    
    Using /usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
    Processing dependencies for pip
    Finished processing dependencies for pip
      pip list
    Cheetah (2.4.4)
    Cython (0.20.2)
    docutils (0.12)
    gnureadline (6.3.3)
    ipython (2.2.0)
    Jinja2 (2.7.3)
    lxml (3.3.6)
    Markdown (2.4.1)
    MarkupSafe (0.23)
    pip (1.5.6)
    Pygments (1.6)
    setuptools (5.4.2)
    Sphinx (1.2.3)
    wsgiref (0.1.2)
    wxPython (3.0.0.0)
    wxPython-common (3.0.0.0)
    u0m3_ : gyaresu, you are using wx. to use qt, you need to get the sinks and gui elements from the qt subcategory
                             (e.g.: instrumentation->qt->qt sink) and set "general option" to qt gui in options block

    GNURadio Qt video using gr-qtgui blocks to follow.

    Posted in 




    The NSA Playset

    Posted in  hacking


    A 30 year history of the future

    Posted in  futurist


    How to extract audio from a video via ffmpeg

    FFmpeg is one of the core tools you don't know you need until you need it.

    FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It contains libavcodec, libavutil, libavformat, libavfilter, libavdevice, libswscale and libswresample which can be used by applications. As well as ffmpeg, ffserver, ffplay and ffprobe which can be used by end users for transcoding, streaming and playing.

    I just used it to strip a 6GB iPhone video file down to the 21MB audio actually needed.

    $ ffmpeg -i some_movie_file.{mov/mp4/mkv/whatever} output_file.mp3
    

    Posted in  audiovisual


    HackRF One Prototype

    Welcome to the future. All your radio frequencies are belong to me. 
    
    The HackRF is a Software Defined Radio (SDR) device. 
    
    It will allow me to transmit and receive all frequencies between 10MHz and 6GHz while using a computer to shape those waveforms. Normally only possibly with rooms full of expensive dedicated equipment. 
    
    When hackers got access to cheap SDR WiFi cards, that's when WiFi was broken (WEP/WPA/WPA2) and now it's time for everything from GSM phones, to 1970's satellites to come under scrutiny. 
    
    Incredible tools lead to amazing discoveries. 
    
    It's a great time to be a geek.
    

    HackRF One Prototype from Gareth on Vimeo.

    Nokia N900 running Maemo 5 broadcasting music on 91.4 FM.

    FM reception test:
    Debian Testing
    Linux 3.2.0-4-amd64
    gqrx-sdr 2.2.0.137
    hackrf 2014.04.1-1
    

    Music: Telefon Tel Aviv - At the Edge of the World You Will Still Float

    Posted in  sdr


    The failure triptych

    These Comtrend routers are all over Spain:

    Comtrend password fail

    Comtrend source fail

    Comtrend owned fail

    Posted in  hacking


    Outsource this

    90 Thousand line broken CSV file. UTF-8.

    Cyrilic and hanzi characters/logograms showing...

    ... Latin-1 diacritic characters broken.

    i.e. Flórez instead of Flórez

    Attached is a zip file containing two text files.
    
    I’ve removed most character-type garbage and (non-visible) termination characters. 
    
    I wouldn’t use it to import into a database but this should be adequate for your stated requirements. 
    
    Should you wish any further alterations please don’t hesitate to ask.
    

    Final command used to clean, sort, remove duplicates, reshuffle and output to separate file:

    ⇒  gsed -e 's/[0-9]//g' -e 's/,/ /g' -e 's/é/é/g' -e 's/"//g' -e '/^$/d' -e 's/´/´/g' -e 's/ú/ú/g' -e 's/ñ/ñ/g' -e 's/ó/ó/g' -e 's/á/á/g' -e 's/ù/ù/g' -e 's/à /Á/g' -e 's/Ñ/Ñ/g' -e 's/  / /g' -e 's/[[:space:]]$//' -e 's/ò/ò/g' -e 's/í/í/g' -e 's/ì/ì/g' -e 's/ü/ü/g' -e 's/À/À/g' -e 's/ç/ç/g' -e 's/è/è/g' -e 's/É/É/g' -e 's/Ó/Ó/g' -e 's/ê/ê/g' -e 's/ä/ä/g' -e 's/Ê/Ê/g' -e 's/ö/ö/g' -e 's/Ú/Ú/g' -e 's/Ã^Í/Í/g' -e 's/Ã^Á/Á/g' -e 's/ÃŒ/Ì/g' -e 's/î/î/g' -e 's/ï/ï/g' -e 's/ã/ã/g' -e 's/Ä/Ä/g' -e 's/Ã/à/g' 90K_list_of_names.csv |sort |uniq | gshuf > 80K_clean_list.txt
    

    Followed by a command to remove the newline (carriage return) characters and replace them with two spaces for design use:

    ⇒  gsed ':a;N;$!ba;s/\n/  /g' 80K_clean_list.txt > two_space_separated.txt
    

    Show file with line breaks, tabs and non-printing characters

    gcat -A thing.txt

    Great reference: UTF-8 Encoding Debugging Chart

    Posted in  hacking


    IT Support done right

    IT Haiku

    Posted in  itsupport



    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](http://en.wikipedia.org/wiki/Du_(Unix)) and [df](http://en.wikipedia.org/wiki/Df_(Unix)).

    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 +0000">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


    Demand exceptional performance in everything you do

    Because it should always matter. And when it doesn't then it's time to do something else.

    Hello

    I would like to send a huge thank you to all of the staff of Seaflight on Monday 30th May who went to so much effort to make sure we all had a great time.

    I boarded the boat with no intention of scuba diving in my life, let alone that day! But the crew knew that most of that fear comes from misunderstanding what is involved. I had never successfully used snorkel gear before and didn't like being in the sea much. I was curious though when I saw the staff members demonstrating diving equipment about what it would feel like to wear diving gear and stick my head under the water so when I found out I could get my money back if I didn't like it, I was ready to consider it as I figured I had nothing to lose. I have problems with anxiety so I thought I'd never find anybody willing to take me diving. But I explained this to Gareth who was understanding and said he'd take me diving himself at my own pace.

    I was amazed at how quickly they got us into the water, but I didn't feel the pressure of having to pretend not to be scared, which was great. The crew laughed and joked, which put me at ease. Gareth was happy to hold my hand the whole time which helped because I didn't have to worry about getting lost. When I felt confident enough to swim on my own, he showed me interesting fish and stayed close by. When I left the water half an hour later, I felt completely different about the ocean. I love watching fish in aquariums so it was great to get to meet them up close and I got to be part of a world I never thought I would see. I don't think I'm going to dive on a regular basis but just knowing that I can do it if I want to is amazing. I felt my confidence boosted massively.

    Later in the day I had a go at snorkelling, which seemed simple after scuba diving. I did have some problems with using the mask but the crew were quick to help and one of them even got into the water to help me use it properly. I saw amazing fish. I snorkelled on the Camira trip today and now feel confident enough to snorkel more in future.

    I boarded the boat knowing nobody and left it knowing pretty much everybody and with some new friends.

    I'm a pretty sceptical person usually and I don't tend to believe all the clicheed quotes in brochures but you can take this from me: it was a life-changing and life affirming experience that I will remember for the rest of my life and probably the best day of my 3 month trip.

    Please pass on my thanks to Gareth and the rest of the team.

    And we're still Facebook friends :)

    Posted in  diving


    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  business


    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


    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


    ziplock omelette

    Source: http://www.ilovebacon.com/071706/f.shtml <- Dead link

    "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  camping


    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


    Ray

    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