Skip to content

Instantly share code, notes, and snippets.

@kylegibson
kylegibson / capitalone.user.js
Last active Oct 13, 2016
Parse transactions in capitalone and print into console
View capitalone.user.js
// ==UserScript==
// @name capitalone
// @namespace kyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @include https://servicing.capitalone.com/*
// @grant none
// ==/UserScript==
//
$(function() {
View gist:3375720
import pyev
class FiveSecondTimer(object):
def __init__(self, data):
self.data = data
def __call__(self, watch, revents):
print 'foo', data
loop = pyev.default_loop()
View gist:3375704
import pyev
def run_every_5_seconds(watcher, revents):
print 'foo'
loop = pyev.default_loop()
run_every_5_seconds_loop = loop.timer(0, 5, run_every_5_seconds)
run_every_5_seconds_loop.start()
loop.start()
View gist:3373805
> pip uninstall pyyaml
Exception:
Traceback (most recent call last):
File "/home/kyle/testenv/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/home/kyle/testenv/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/commands/uninstall.py", line 41, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/home/kyle/testenv/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/req.py", line 862, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/home/kyle/testenv/lib/python2.6/site-packages/pip-1.1-py2.6.egg/pip/req.py", line 461, in uninstall
@kylegibson
kylegibson / timetests.py
Created Mar 13, 2012 — forked from mahmoudimus/nose-timetests.py
Nose plugin to time tests
View timetests.py
"""This plugin provides test timings to identify which tests might be
taking the most. From this information, it might be useful to couple
individual tests nose's `--with-profile` option to profile problematic
tests.
This plugin is heavily influenced by nose's `xunit` plugin.
Add this command to the way you execute nose::
--with-test-timer
View timeline_of_history_data.yml
dateTimeFormat: gregorian
events:
- title: Jamestown founded
start: May 14 1607
- title: Mayflower Compact
start: Nov 11 1620
- title: English Civil War
start: 1642
@kylegibson
kylegibson / update_bitcoin_prices.sh
Created Oct 12, 2011
Bash script to scrape current bitcoin exchange prices and update a local json file
View update_bitcoin_prices.sh
#!/bin/bash
BTC_PATH=$1
REMOTE_URL=http://bitcoincharts.com/t/weighted_prices.json
wget -q -O $BTC_PATH.temp $REMOTE_URL
test $? -ne 0 && exit
test ! -e $BTC_PATH.temp && exit
test $(stat -c%s $BTC_PATH.temp) -lt 600 && exit
mv $BTC_PATH{.temp,}
@kylegibson
kylegibson / php-fastcgi.sh
Created Oct 10, 2011
php fast-cgi sysvinit script
View php-fastcgi.sh
#!/bin/bash
BIND=/tmp/php-fcgi.sock
USER=frozen
PHP_FCGI_CHILDREN=10
PHP_FCGI_MAX_REQUESTS=300
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=$(basename $PHP_CGI)
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
@kylegibson
kylegibson / VirtualBox-4.0.8-VBoxSVC-daemonize-pidfile.patch
Created Oct 10, 2011
Patch file for VirtualBox 4.0.8 to correctly pass start parameters onto spawned daemon process
View VirtualBox-4.0.8-VBoxSVC-daemonize-pidfile.patch
--- VirtualBox-4.0.8_OSE/src/VBox/Main/src-server/xpcom/server.cpp 2011-05-16 12:33:47.000000000 -0400
+++ VirtualBox-4.0.8_OSE.fix/src/VBox/Main/src-server/xpcom/server.cpp 2011-05-18 18:01:04.784596001 -0400
@@ -712,15 +712,23 @@
}
}
-static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath)
+static nsresult vboxsvcSpawnDaemonByReExec(const char *pszPath, bool bAutoShutdown, const char *pszPidFile)
{
PRFileDesc *readable = nsnull, *writable = nsnull;
@kylegibson
kylegibson / gist_scrape.php
Created Oct 9, 2011
PHP script to scrape data from a gist page
View gist_scrape.php
<?
function get_gist_url($id) {
$data = file_get_contents("https://gist.github.com/$id");
$pos1 = strpos($data, "/raw/$id");
$pos2 = strpos($data, "\"", $pos1);
$url = substr($data, $pos1, $pos2-$pos1);
return "https://gist.github.com$url";
}
$url = get_gist_url($_GET["id"]);
ob_start('ob_gzhandler');