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 / 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()
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 / 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
/*
[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.
[general]
ui = ttyui
accounts = gmail,crimson
fsync = False
[Account gmail]
localrepository = gmail-local
remoterepository = gmail-remote
status_backend = sqlite
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
@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
@cscorley
cscorley / jekyll.py
Last active January 9, 2021 21:47
IPython to Jekyll Markdown
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
BLOG_DIR = os.environ['BLOG_DIR']
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/'
from ctypes import *
class Cell(Structure):
pass
Cell._fields_ = [
("val", c_int),
("next", POINTER(Cell))]
class LinkedList:
from timeit import timeit
from ctypes import *
size = 10
l = list()
arr = (c_int * size)()
def test(x):
for n in range(x):
l.append(n)