April 24, 2012
If you want to leave Github for whatever reason, you probably want to take all your code with you, and all your history and branches, etc.
Here's an example for how I moved my Android Eclipse workspace from Github to my own remote server.
First I make a new git repo on my remote server:
$ git --bare init ~/git/workspace
The --bare option means I'm not going to work on the code in the remote git repo directly.
Next I push my current local 'master' to the new repo:
$ git checkout master
$ git push ssh://me@myserver.com/git/workspace master
After that I push my working branch:
$ git checkout work
$ git push ssh://me@myserver.com/git/workspace work
You could repeat this step if you have more branches.
I created my local repo using 'clone' so it has an 'origin' remote branch defined. This 'remote' branch is where git fetches and pushes changes.
Right now my 'fetch' and 'push' remote origins point to Github:
$ git remote -v
git@github.com:gdonald/workspace.git
git (3) github (1)
January 7, 2012
I had a problem with PostgreSQL pgdump recently. My setval() calls were all set to '1'. I whipped up this quick script to fix things: #!/usr/bin/env python DB_NAME = 'my_db' from subprocess import Popen, PIPE import re exclude = [ 'tablename', 'rows' ] tp = re.compile( '[^a-z_]' ) ts = Popen( [ "/usr/bin/psql", DB_NAME, "-c SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%' AND tablename NOT LIKE 'sql_%' ORDER BY tablename" ], stdout=PIPE ).communicate()[ 0 ].split( ' ' ) tables = [] for t in ts: t = tp.sub( '', t ) if len( t ) == 0 or t in exclude: continue tables.append( t ) for t in tables: sql = "SELECT pg_catalog.setval( pg_get_serial_sequence( '%s', 'id' ), ( SELECT MAX( id ) FROM %s ) + 1 );" % ( t, t ) print Popen( [ "/usr/bin/psql", DB_NAME, "-c %s" % sql ], stdout=PIPE ).communicate()[ 0 ]
postgresql (3) python (2)
April 3, 2011
# basic .muttrc for use with Gmail # Change the following six lines to match your Gmail account details set imap_user = "username@gmail.com" set imap_pass = "" set smtp_url = "smtp://username@smtp.gmail.com:587/" set smtp_pass = "" set from = "username@gmail.com" set realname = "Firstname Lastname" # # # Change the following line to a different editor you prefer. set editor = 'vim + -c "set textwidth=72" -c "set wrap"'
gmail (1) mutt (1)
January 26, 2010
If you're using a flavor of *nix that has an rc.local file, and then you start using Debian GNU/Linux, you might be wondering where your rc.local file is. Quite simply, it's not there. Here's how to add it.
Create a new file named /etc/init.d/local like this:
#!/bin/sh
# put startup stuff here
Make the file executable:
chmod 755 /etc/init.d/local
Add it to startup:
update-rc.d local defaults 80
You should be seeing something like this:
Adding system startup for /etc/init.d/local ...
/etc/rc0.d/K80local -> ../init.d/local
/etc/rc1.d/K80local -> ../init.d/local
/etc/rc6.d/K80local -> ../init.d/local
/etc/rc2.d/S80local -> ../init.d/local
/etc/rc3.d/S80local -> ../init.d/local
/etc/rc4.d/S80local -> ../init.d/local
/etc/rc5.d/S80local -> ../init.d/local
linux (8) debian (5)
January 14, 2006
Here's a command to install lots of games on your Debian box:
yes | \
for x in `apt-cache search game \
| sort \
| awk 'BEGIN { FS = " - " } { print $1 }'`; do \
apt-get install $x; \
done
game (5) debian (5)