Skip to content

Instantly share code, notes, and snippets.

View swenson's full-sized avatar
🍰
cupcake

Christopher Swenson swenson

🍰
cupcake
View GitHub Profile
#!/bin/bash
ENDPOINT="api.sandbox.paypal.com"
CLIENT_ID=""
SECRET=""
#ENDPOINT="api.paypal.com"
#CLIENT_ID=""
#SECRET=""
@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):
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 / 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:

@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 / 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 / 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 / gist:5241278
Created March 25, 2013 22:12
givaro-3.7.1 error log
Using local scripts to install givaro-3.7.1
Found local sources at upstream/givaro-3.7.1.tar.bz2
givaro-3.7.1
====================================================
Setting up build directory for givaro-3.7.1
Finished set up
****************************************************
Host system:
Linux sagedev 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
****************************************************
In [35]: def a():
a = yield 4
print a
....:
In [36]: b = a()
In [37]: b.next()
Out[37]: 4
@swenson
swenson / Make.user
Created January 3, 2014 20:38
GCE Make.user for building Julia
USE_SYSTEM_LLVM=0
USE_SYSTEM_ARPACK=1
USE_ATLAS=1
USE_BLAS64=0
USE_SYSTEM_BLAS=1
USE_SYSTEM_LAPACK=1
ATLAS_LIBDIR=/usr/lib
LIBBLAS=-L$(ATLAS_LIBDIR) -latlas
LIBLAPACK=$(LIBBLAS)
LIBBLASNAME = libatlas