This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(requests.post('https://www.calvin.edu/dwr/call/plaincall/CalendarAjax.findEvents.dwr', 'callCount=1\nwindowName=\nc0-scriptName=CalendarAjax\nc0-methodName=findEvents\nc0-id=0\nc0-param0=date:1387602000000\nc0-param1=date:1387689499000\nc0-param2=array:[]\nc0-param3=array:[]\nc0-param4=array:[]\nc0-param5=\nc0-param6=\nc0-param7=\nc0-param8=\nbatchId=0\ninstanceId=0\npage=/calendar/index.html\nscriptSessionId=asdf\n').content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js'></script> | |
<script> | |
function isCached(img_src) { | |
var dfd = $.Deferred(); | |
var start_time = $.now(); | |
var img; | |
var timeout = setTimeout(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import re, subprocess | |
def parse_line(line): | |
"returns (SECURITY, RSSI) if the line is a wifi network" | |
pattern = ':'.join(['[a-f0-9]{2}']*6) | |
reg = re.search(pattern, line) | |
try: | |
latter = line[reg.end():].split() | |
return (latter[-1], int(latter[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# this code is all wrong; don't use it. | |
# constant IV + allowing a plaintext attack means that this is totally broken. | |
# the intention was to be able to store javascript code in URLs and then run it. | |
# but that problem needs authentication, not encryption. | |
# so, just add an HMAC's 128-bit digest to the URL. | |
import string | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
r=requests.get('http://en.wikipedia.org/w/index.php?title=Credit_card_interest&offset=&limit=5000&action=history') | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(r.text) | |
date_strings = (a.text for a in soup.select('a.mw-changeslist-date')) | |
from dateutil import parser | |
dates = (parser.parse(date) for date in date_strings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//investigate the memory layout of a c++ program | |
//run with: `gcc b.c && ./a.out $(seq 1000) | sort | uniq` | |
#define OUT(var) printf("%16lx %s\n", (unsigned long int) &var, #var ) | |
#define NL printf("\n") | |
#include <stdio.h> | |
#include <stdlib.h> | |
char global_const = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Notes: since we're just taking everything, we're not using the information in this comment block. | |
# Note: dialog_partner is no longer reliable as of 2015 Aug 25. | |
# Good columns are: timestamp, convo_id, author, body_xml. | |
# To find the right convo_id, run | |
# $ sqlite3 path/to/main.db | |
# > select datetime(timestamp, 'unixepoch'),convo_id,author from Messages; | |
# > select count(*) from Messages; | |
# > select count(*) from Messages where convo_id = 270; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess, random | |
rows, columns = (int(r) for r in subprocess.check_output([b'stty', b'size']).split()) | |
data1 = [(x*0.1, random.gauss(40,3) - 30*(x/100.)**2) for x in range(0,100)] | |
data2 = [(x*0.1, random.gauss(20,3) + 30*(x/100.)**2) for x in range(0,100)] | |
gnuplot = subprocess.Popen("/usr/bin/gnuplot", stdin=subprocess.PIPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
error() { | |
local parent_lineno="$1" | |
local message="$2" | |
local code="${3:-1}" | |
if [[ -n "$message" ]] ; then | |
echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list(v.update(num_bad_guesses=sum(1 for g in guesses if g not in chosen_word)) or \ | |
((10 <= v['num_bad_guesses'] and prin('You lose!\n'+scaffold.format(*man))) or \ | |
(all(l in guesses for l in chosen_word) and prin('You win!'))) and \ | |
(prin('Word was ' + chosen_word) and next(iter([]))) or \ | |
prin(','.join(sorted(guesses)) + '({} guesses left)'.format(10-v['num_bad_guesses'])+'\n' + | |
scaffold.format(*man[:v['num_bad_guesses']]+' '*10)) and \ | |
guesses.update(filter(str.isalpha, | |
inpt(' '.join(l if l in guesses else '_' for l in chosen_word)+': ').upper())) \ | |
for (license, chosen_word, guesses, scaffold, man, v, prin, inpt) in [( | |
'https://opensource.org/licenses/MIT', |
OlderNewer