Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cdsboy on github.
  • I am cdsboy (https://keybase.io/cdsboy) on keybase.
  • I have a public key ASCLy5YqKUoRrtfNoBNy2PUOVODwhh02p0aTtXRSPLk8MQo

To claim this, I am signing this object:

Rules
* Don't Spoil things for people. If in doubt, ask first and move it to a query.
* No public away messages.
* No excessive usage of /nick (excessive is up to channel ops to define)
* Don't append things to your nick to indicate where you are or what computer you're using. No one cares and it's annoying.
* No threats, personal attacks, or encouraging suicide (the ops have a sense of humor, don't worry)
* When an op tells you to drop a subject, drop it. It's all about keeping harmony.
* English is the preferred language of the channel, but of course there will be incidental Japanese.
* Don't spam the channel. (Tons of short lines, copypasta, etc.)
Model: ATA HGST HUS724040AL (scsi)
Disk /dev/sdb: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB grub bios_grub
2 3146kB 137MB 134MB ext2 boot raid
3 137MB 4001GB 4001GB linux-swap(v1) rootfs raid
def function_to_test(conn, my_json):
data = json.loads(my_json)
data = manipulat(data)
conn.execute(myquery, data)
class TestClass(UnitTest):
class ConnMock(object):
def execute(self, _, data):
assert data == expected_data
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
dir="`git rev-parse --git-dir`"
trap 'rm -f "$dir/$$.tags"' EXIT
git ls-files | \
ctags --tag-relative -L - -f"$dir/$$.tags" --languages=-javascript,sql
mv "$dir/$$.tags" "$dir/tags"
try:
import smartlogging
except ImportError:
# this system is not setup for logging, turn it off
logging = False
else:
# spend 20 lines discovering logging settings and trying to connect to logging servers
vs.
>>> try:
... print "A"
... except:
... print "B"
... else:
... print "C"
... finally:
... print "D"
...
A
>>> for i in range(3):
... print i
... else:
... print "Done"
...
0
1
2
Done
>>> for i in range(3):
stuff = {}
with data as open('myfile', 'r'):
lines = data.split('\n')
for line in lines:
#magically split your line
#so that you end up with a username var and whatever else you want
stuff[username] = usefulinformation
#data now has all of the users as key and their values as whever latest data you want