Skip to content

Instantly share code, notes, and snippets.

View nicksloan's full-sized avatar

Nick Sloan nicksloan

View GitHub Profile
@nicksloan
nicksloan / gist:4120305
Created November 20, 2012 19:10
Subclass AWSQueryConnection and define a _required_auth_capability(self) function returns a list which includes the unique capability of the desired auth handler plugin.
class AWISQueryConnection(AWSQueryConnection):
def _required_auth_capability(self):
return ['sign-v2']
def alexa_rank(url):
conn = AWISQueryConnection(
aws_access_key_id=config.aws['key'],
aws_secret_access_key=config.aws['secret'],
host='awis.amazonaws.com',
is_secure=False,
import atexit
import os, sys
import readline
import rlcompleter
history = os.path.expanduser('~/.python_history')
readline.read_history_file(history)
readline.parse_and_bind('tab: complete')
atexit.register(readline.write_history_file, history)
import random
data = list()
for i in range(10000):
data.append(random.randint(0, 2**32))
bits_set = {0: 0}
for i in range(256):
bits_set[i] = (i & 1) + bits_set[i / 2]
#include <stdio.h>
#include <stdlib.h>
typedef struct element {
int val;
struct element * next;
} item;
item * makeitem(item * curr, int value) {
printf("%d\n", value);
ProjectName
+---package
| +---__init__.py
| +---web
| | +---__init__.py
| +---spider
| +---__init__.py
+---setup.py
+---readme.md
+---tests
import argparse
def foo():
print 'Hi'
def bar():
print 'Hello!'
def test(arg=[]):
print arg
del arg
test()
test()

Keybase proof

I hereby claim:

  • I am nicksloan on github.
  • I am nicksloan (https://keybase.io/nicksloan) on keybase.
  • I have a public key whose fingerprint is 3431 D313 841E 3916 0E85 9A41 EDEC 7F5A 3E21 FA8B

To claim this, I am signing this object:

include:
# for backports
- apt
openssh6.6:
pkg.installed:
# backports; this number *will* change
- pkgs:
- openssh-server: 1:6.6p1-4~bpo70+1
- openssh-client: 1:6.6p1-4~bpo70+1
@nicksloan
nicksloan / _modules:boto_fk.py
Created October 9, 2015 03:33 — forked from scoates/_modules:boto_fk.py
Salt: Auto-assign public IPs in VPC subnets
# -*- coding: utf-8 -*-
'''
TODO
'''
# keep lint from choking on _get_conn and _cache_id
#pylint: disable=E0602
# Import Python libs
from __future__ import absolute_import