~bin/
things in my bin
Fri Dec 4 10:17:05 2009
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\   exe "normal g'\"" |
\ endif
Wed Dec 2 18:58:08 2009

A little script for automating screencap pasting via Dropbox. Nice if you bind it to a couple keys:

C-PrintScreen dbcap
S-PrintScreen dbcap -s

and etc ...

#!/bin/bash
# use Dropbox like cap.sprunge.us
# requires scrot and xclip

cap=~/"Dropbox/Public/screen.jpg"

[ -d "$(dirname $cap)" ] || exit
scrot $* $cap || exit
dropbox puburl $cap | xclip -i -f
Tue Dec 1 10:51:20 2009
# Dynamic domains on a private tld
#
# butts.lol will map to /home/user/lol/butts
# haha.butts.lol will map to /home/user/lol/haha.butts/
#
# So all you have to do to get <name>.lol is mkdir /home/user/lol/<name>
#
# 404 handling is a bit tricky, cause just mapping to /404.html would cause
# a request to haha.butts.lol to look for /home/user/lol/haha.butts/404.html
# So we define a directory with an Alias, so /404/ will always map to a
# single directory.
#
# The idea is that any url that maps to a nonexistent path will hit /404/,
# Then create and delete subdirectories as needed and they resolve nicely.
#
# basic structure is
# /home/user/lol
# /home/user/lol/404
# /home/user/lol/logs

# DNS
# we need to be running a local nameserver to handle requests to the .lol
# tld. other requests get passed through to the normal nameservers. We'll
# use dnsmasq. Mac people might want to look at:
# http://www.macosxhints.com/article.php?story=2005110220352084

dnsmasq:
    dnsmasq.conf
        # send all requests to a .lol to localhost
        address=/.lol/127.0.0.1
        # only listen to localhost
        listen-address=127.0.0.1

dhcp:
   dhclient.conf
        # puts our dns server before any others
        prepend domain-name-servers 127.0.0.1;

# APACHE

# Load the vhost_alias module

cd /etc/apache2/mods-enabled
ln -s ../mods-available/vhost_alias.load .

# Configure a virtual host in /etc/apache2/sites-enabled/

<VirtualHost *>
        ServerAdmin user@localhost
        ServerAlias *.lol
        ServerName .lol

        DocumentRoot /home/user/lol/
        VirtualDocumentRoot /home/user/lol/%-2+

        ErrorDocument 404 "/404/index.html"

        <Directory /home/user/lol/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        Alias /404/ /home/user/lol/404/
        <Directory "/home/user/lol/404">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        LogLevel warn
        ErrorLog /home/user/lol/logs/error.log
        CustomLog /home/user/lol/logs/access.log combined

        ServerSignature Off

</VirtualHost>
[newer][older]