Skip to content

Instantly share code, notes, and snippets.

View jsocol's full-sized avatar
🙃
for oss: hoping to get back to a monthly check-in/update cadence

James Socol jsocol

🙃
for oss: hoping to get back to a monthly check-in/update cadence
View GitHub Profile
@jsocol
jsocol / gist:950670766ab0ddbd1e7d
Created July 18, 2014 12:37
spam source code
{
{I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any
interesting article like yours. {It’s|It is} pretty worth enough for me.
{In my opinion|Personally|In my view}, if all {webmasters|site owners|website
owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn’t|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I’ll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can’t} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink}
or {newsletter|e-newsletter} service. Do {you have|you’ve} any?
@jsocol
jsocol / gist:7c2fbccab5a303bb724c
Created February 5, 2015 19:01
python gae sdk virtualenv: what to symlink where
ln -s /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google /path/to/virtualenv/lib/python2.7/site-packages/google
@jsocol
jsocol / gist:5ca69c9dd5761f55bfd4
Created February 12, 2015 17:57
python is less crazy than it seems
In [8]: def t():
f = ([],)
f[0] += [1]
return f
...:
In [9]: dis.dis(t)
2 0 BUILD_LIST 0
3 BUILD_TUPLE 1
6 STORE_FAST 0 (f)
@jsocol
jsocol / 1f.py
Last active August 29, 2015 14:15
def f1():
a = 0
a += 1
dis.dis(f1)

Keybase proof

I hereby claim:

  • I am jsocol on github.
  • I am jamessocol (https://keybase.io/jamessocol) on keybase.
  • I have a public key whose fingerprint is B856 FE22 4F11 9DB0 F88E 3BDD 80F9 3DCE 9EBF CF1D

To claim this, I am signing this object:

from boto.dynamodb2 import connect_to_region
from boto.provider import Provider
aws_settings_provider = Provider('aws')
def create_connection():
aws_region = # get the AWS region of the EC2 instance
# connect_to_region passes along the named arguments
# to the DynamoDBConnection class that gets created
@jsocol
jsocol / classes.py
Created July 20, 2015 21:00
why new-style classes?
>>> class NewStyle(object):
... def foo(self):
... return 'foo'
>>> class OldStyle():
... def foo(self):
... return 'foo'
>>> dir(NewStyle)
['__class__',
@jsocol
jsocol / gist:430348
Created June 8, 2010 17:28
fm - flush memcache
#!/bin/bash
# Flush memcached with a single command.
echo "flush_all" | nc localhost 11211
@jsocol
jsocol / gist:430368
Created June 8, 2010 17:36
git-fall - Fetch and prune all remotes
#!/bin/bash
# Fetch and prune all remotes.
for r in `git remote`
do
git remote prune $r
git fetch $r
done