Skip to content

Instantly share code, notes, and snippets.

View graph.py
numpy.genfromtxt(path, delimiter=',', names=True, dtype=None)
fig = plt.figure(1)
plt.xlabel('Month')
plt.ylabel('Cost of Food')
plt.title('Cost of Food from May 2013 to May 2014)
# month is a tuple I created for this data, month[0] is number of month, month[1] is numpy array
plt.plot_date([month[0] for month in data], [month[1][0][plan] for month in data], '-b', label=month[1][0][1])
View javascript-common.conf
Alias /javascript /usr/share/javascript/
<Directory "/usr/share/javascript/">
Options FollowSymLinks MultiViews
</Directory>
View gist:8340948787eab2a5948c
(devpi)graingert@adhominem:~/projects/djangosaml2$ tox
GLOB sdist-make: /home/graingert/projects/djangosaml2/setup.py
py26-dj13 inst-nodeps: /home/graingert/projects/djangosaml2/.tox/dist/djangosaml2-0.11.0.zip
py26-dj13 runtests: PYTHONHASHSEED='1754004049'
py26-dj13 runtests: commands[0] | python tests/run_tests.py
Creating test database for alias 'default'...
.Login process started
spentityid: http://sp.example.com/saml2/metadata/
service_url: http://sp.example.com/saml2/acs/
my_name: Test SP
View gist:1bfdd89149de92ed8e29
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"£"
£
>>> import pdb; pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) print u"£"
View redshift tls Server Hello.txt
No. Time Source Destination Protocol Length Info
1113 76.387428000 52.10.35.87 192.168.1.152 TLSv1.2 1293 Server Hello, Certificate, Server Key Exchange, Server Hello Done
Frame 1113: 1293 bytes on wire (10344 bits), 1293 bytes captured (10344 bits) on interface 0
Interface id: 0 (any)
Encapsulation type: Linux cooked-mode capture (25)
Arrival Time: Aug 24, 2015 20:31:14.065002000 BST
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1440444674.065002000 seconds
[Time delta from previous captured frame: 0.198376000 seconds]
View gist:1147447
import random
import copy
ALPHABET = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", " "]
class Scrambler:
"""A single scrambler unit"""
def __init__(self, seed):
self.routes = range(len(ALPHABET))
random.seed(seed)
random.shuffle(self.routes)
View gist:1147493
import random
import copy
ALPHABET = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", " "]
class Scrambler:
"""A single scrambler unit"""
def __init__(self, seed):
self.routes = range(len(ALPHABET))
random.seed(seed)
random.shuffle(self.routes)
View gist:1157299
# -*- coding: utf-8 -*-
"horfunk.radiopirate models and events handlers"
import datetime
import os
import logging
from django.db import models
from django.contrib.auth.models import User
View printf
String template = Exercise 1: Negate a tree (5%%)\n\n" //usually /n's are at the end of the line
+"original tree: \n%s\n"
+"original tree negated: \n%s\n"
+"original tree negated twice (same as original): \n%s\n"
+"empty tree: \n%s\n";
System.out.println();
System.out.printf(template, TreeOps.toString(x), Ex2.negateAll(x), Ex2.negateAll(Ex2.negateAll(x)), Ex2.negateAll(new Tree()));
View 1a.java
/**
* @param word String to be turned into T9 code
* @return the T9 code of the input string
*
* Method returns the order of buttons of digipad buttons to be pressed to
* get the input String from a T9 predictive text dictionary.
*
* This method assumes the order of the buttons is as follows and ignores case:
*
* 2= a,b,c