Skip to content

Instantly share code, notes, and snippets.

View katylava's full-sized avatar
🐢

katy lavallee katylava

🐢
View GitHub Profile
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

@katylava
katylava / woot-description.txt
Created December 3, 2010 17:01
Woot.com description for MASTRAD 12-OUNCE MICROWAVE STEAMER 2-PACK
COMING THIS FALL…
To every TV station in America.
INTERIOR: WE SEE A HARDENED CRIMINAL (NOT AFRICAN-AMERICAN. WE HAVE TO AVOID THAT UNTIL AT LEAST THE THIRD EPISODE) AT A TABLE AT AN INTERROGATION ROOM.
NARRATOR
Insert City here is known for its tough streets and even tougher criminals.
CUT TO: close-up on CRIMINAL’S face
@katylava
katylava / copy-to-psql.py
Created December 8, 2010 17:42
script to load csv file into new postgres table
#!/usr/bin/env python
import re
from subprocess import call
def load_csv_psql(db, infile, table, tmpdir='/tmp'):
tmpfile = '%s/%s' % (tmpdir, infile)
call(['cp', infile, tmpfile])
columns = map(variablize, file(infile).readline().split(','))
@katylava
katylava / gist:733913
Created December 8, 2010 21:08
split csv file into smaller files
split huge-ass csv file into smaller files
$ wc -l *
40989 IrvineCustomerData.csv
$ split -l 5000 IrvineCustomerData.csv IrvineCustomerData-
$ wc -l *
5000 IrvineCustomerData-aa
5000 IrvineCustomerData-ab
@katylava
katylava / gist:736513
Created December 10, 2010 17:49
mysterious facebook status messages
feb 3 2011 (or 4, depending on time zone):
‎195471695564017496821388909521241915186798093657787579850263389344228258431607367165974781493044729262473252588237329452343766118279620113613942439758110537066388115643546100977448552283859966
------------------------------
jan 2 2011:
913079645171132295848982034391433296387886842927441472282754480733924857512938637671119945316578505521454662441015709082483618315852256772596049999838663296231716776956510061403543835726978176
------------------------------
dec 10 2010:
768423263687346188365668821977136825170304042536257207510059917262274579859958541656243150693794939985267331932646196418952944548431138638896034909487177142811811247251077278809255934463351527
------------------------------
aug 12 2010:
@katylava
katylava / set_psql_default_utf8.sql
Created January 4, 2011 18:44
make sure new database are created with encoding UTF8
UPDATE pg_database SET datistemplate=FALSE WHERE datname='template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH owner=postgres template=template0 encoding='UTF8';
UPDATE pg_database SET datistemplate=TRUE WHERE datname='template1';
1051:57 > git ass sitelet/media/images/
git: 'ass' is not a git command. See 'git --help'.
Did you mean one of these?
add
stash
@katylava
katylava / gist:969152
Created May 12, 2011 18:30
silly jeffrey
JeffJeffdyJefe
hi
1:28
Ben sucks and I hate him
1:28
I'm so glad he's not in here
1:28sduniphin
lol me too.
1:28JeffJeffdyJefe
I could do his job
@katylava
katylava / gist:1316377
Created October 26, 2011 13:41
nltk spaceships
In [21]: texts = [text1, text2, text3, text4, text5, text6, text7, text8, text9]
In [22]: for t in texts:
....: print "%d spaceship(s) in %s" % (t.count('spaceship'), t)
....:
0 spaceship(s) in <Text: Moby Dick by Herman Melville 1851>
0 spaceship(s) in <Text: Sense and Sensibility by Jane Austen 1811>
0 spaceship(s) in <Text: The Book of Genesis>
0 spaceship(s) in <Text: Inaugural Address Corpus>
0 spaceship(s) in <Text: Chat Corpus>
@katylava
katylava / loldict
Created December 1, 2011 19:46
Dictionary of Katy's LOLs
LOL = Actually laughed out loud, as witnesses can attest
lol = Laughed out loud, but perhaps not loud enough for anyone to hear
LOFL = "laughing out fucking loud"... as in "OMG THAT WAS HI-FUCKING-LARIOUS"
limh = "laughing in my head"
lolz = "hehe"
lulz = "that was cute and funny"
l. o. l. = sarcastic, as in "ha ha aren't you funny you little shit"