Skip to content

Instantly share code, notes, and snippets.

View swenson's full-sized avatar
🍰
cupcake

Christopher Swenson swenson

🍰
cupcake
View GitHub Profile
@swenson
swenson / backup.sh
Created August 12, 2015 05:17
Install tarsnap. Then, here's some stuff.
#!/bin/bash
NAME="something"
d=$(date "+%F--%H-%M-%S")
/usr/local/bin/tarsnap -c --keyfile /root/tarsnap.key --cachedir /usr/local/tarsnap-cache -f $NAME-backup-$d /etc /home /root /var
@swenson
swenson / debug.asm
Created April 25, 2015 19:37
A 6502 disassembler and debugger (written as part of a NES emulator)
do_a_trap
mov esi, [trap]
test esi, 0x10000
jnz normal_trap
test esi, 0x20000
jnz register_trap
jmp near return_no_cigar
normal_trap
cmp si, [_PC]
jnz near return_no_cigar
@swenson
swenson / Swenson & Poppies.tmTheme
Created April 12, 2015 22:42
Swenson & Poppies Sublime Text theme, based on Slush & Poppies.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>author</key>
<string>William D. Neumann</string>
@swenson
swenson / listing-7-1.py
Created March 31, 2015 22:14
Code samples from Modern Cryptanalysis by Christopher Swenson
# The number of bits in the S-box
sbits = 6
# Calculate the maximum value / differential
ssize = 2**6
# Generate the matrix of differences, starting
# at all zeros
count = []
for i in range(ssize):
@swenson
swenson / runTests.sh
Last active July 30, 2021 22:30
Run Android tests (returning with exit code 1 if they fail)
# Use whatever your test app directory is for ExampleTest, and whatever the
# package you are testing for com.example.test
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"
pushd ExampleTest
# adb shell throws away the return value, so we have to hack do some magic
# see https://code.google.com/p/android/issues/detail?id=3254
@swenson
swenson / gist:cf74cd8e282443b43b8a
Created May 21, 2014 15:51
Google Interview Study Guide
Author unknown.
1.) Algorithm Complexity: You need to know Big-O. If you struggle with
basic big-O complexity analysis, then you are almost guaranteed not to
get hired.
For more information on Algorithms you can visit:
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index
2.) Coding: You should know at least one programming language really
well, and it should preferably be C++ or Java. C# is OK too, since
@swenson
swenson / keybase.md
Created March 29, 2014 18:16
Keybase proof

Keybase proof

I hereby claim:

  • I am swenson on github.
  • I am swenson (https://keybase.io/swenson) on keybase.
  • I have a public key whose fingerprint is 5FF9 4B3B 213C 16A0 7A08 4585 4FC1 860F 7A72 6488

To claim this, I am signing this object:

from sliderepl import Deck
Deck.run()
### slide::
# Let's start by loading some stuff we're going to need.
import requests
import json
import os
from pprint import pprint
@swenson
swenson / paypal.py
Created February 25, 2014 03:51
Deferred payment in Python for PayPal
import json
import requests
class PaymentInfo(object):
def __init__(self, credit_card, transaction):
self.credit_card = credit_card
self.transaction = transaction
class CreditCard(object):
def __init__(self, number, type, expire_month, expire_year, cvv2, first_name, last_name, billing_address):
#!/bin/bash
ENDPOINT="api.sandbox.paypal.com"
CLIENT_ID=""
SECRET=""
#ENDPOINT="api.paypal.com"
#CLIENT_ID=""
#SECRET=""