Skip to content

Instantly share code, notes, and snippets.

View cscorley's full-sized avatar
🐷
PIG MODE

Christopher Corley cscorley

🐷
PIG MODE
View GitHub Profile
@cscorley
cscorley / trello.py
Last active August 29, 2015 14:04
Trello application puzzle in Python
letters = "acdegilmnoprstuw"
def hash(s):
h = 7
for char in s:
h = h * 37 + letters.index(char)
return h
target = 910897038977002.0
current = target
umount /dev/sda*
# Create a new disk label for GPT. Type y when prompted after running:
parted /dev/sda mklabel gpt
#Partition the USB drive or SD card:
cgpt create -z /dev/sda
cgpt create /dev/sda
cgpt add -i 1 -t kernel -b 8192 -s 32768 -l U-Boot -S 1 -T 5 -P 10 /dev/sda
cgpt add -i 2 -t data -b 40960 -s 32768 -l Kernel /dev/sda
cgpt add -i 12 -t data -b 73728 -s 32768 -l Script /dev/sda
cgpt add -i 3 -t data -b 106496 -s `expr 15633375 - 106496` -l Root /dev/sda
[general]
ui = ttyui
accounts = gmail,crimson
fsync = False
[Account gmail]
localrepository = gmail-local
remoterepository = gmail-remote
status_backend = sqlite
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@cscorley
cscorley / repos
Created September 1, 2014 20:17
eclipse repos
git://git.eclipse.org/gitroot/platform/eclipse.platform.common.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.debug.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.news.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.basebuilder.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.buildtools.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.eclipsebuilder.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.maps.git
cscorley@geogaddi: ~
% python2
Python 2.7.8 (default, Jul 1 2014, 17:30:21)
[GCC 4.9.0 20140604 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = u"test💩word"
>>> s
u'test\U0001f4a9word'
>>> type(s)
<type 'unicode'>
@cscorley
cscorley / iup.py
Last active August 29, 2015 14:06
internet uptime script
#!/usr/bin/python3
import sqlite3
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from dateutil.parser import parse
conn = sqlite3.connect('iup.db')
c = conn.cursor()
\newcommand{\attn}[1]{{\color{red}#1}}
\newcommand{\desc}[1]{{\emph{\color{blue}#1}}}
\newcommand{\needcite}{\attn{\tiny{[cite]}}}
@cscorley
cscorley / README.md
Last active August 29, 2015 14:10
Teaching SOP
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from node import Node
class LinkedList:
def __init__(self, iterable=None):
last = None
if iterable:
for item in reversed(iterable):