Skip to content

Instantly share code, notes, and snippets.

View jmk's full-sized avatar

Jason Kim jmk

View GitHub Profile
@jmk
jmk / raffle.py
Created August 19, 2015 22:46
Raffle script
# A quickie raffle script that uses random.org to choose winning entries.
import urllib2
winners = 1
entries = [
"foo",
"bar",
"baz",
@jmk
jmk / gist:be320203f8fd189c72c6
Created January 20, 2015 04:55
Tweet chain
Using a quick hack to follow the chain of links from this tweet: https://twitter.com/MoldyMagnet/status/557259478215577600
@MoldyMagnet 2015-01-19 19:33:07 -- Have we learned nothing? This is the kind of world we are living in: https://t.co/Mfwi7AUbpm
@asuter 2015-01-19 04:19:56 -- The sort of blinkard philistine pig-ignorance I've come to expect from non-creative garbage. https://t.co/GMkAa81DQO
@doctroid 2015-01-19 04:02:47 -- I blame Matt McIrvin. https://t.co/8zdFGrNX90
@sciencecomic 2015-01-19 03:12:41 -- Utter tripe. Irreconcilable. https://t.co/sroTUQHGTg
@arthur_affect 2015-01-19 03:09:50 -- Why do I let myself get dragged into this nonsense https://t.co/3HKAhXfAUi
@GlennF 2015-01-19 01:47:31 -- This has gone on far too long. https://t.co/JCb5CeOqhr
@margarita 2015-01-19 01:46:24 -- Speechless. https://t.co/Er7YgnbhqB
@alexmassie 2015-01-18 22:01:06 -- Shameful but not, alas, surprising. https://t.co/9fVJUZ02sv
@jmk
jmk / timelapse.py
Created September 11, 2014 22:27
screen capture timelapse script
interval = 60 * 5
import time, os
while (True):
cmd = "/usr/sbin/screencapture -C -t jpg -x %f.jpg" % time.time()
print cmd
os.system(cmd)
time.sleep(interval)
### Keybase proof
I hereby claim:
* I am jmk on github.
* I am jmk (https://keybase.io/jmk) on keybase.
* I have a public key whose fingerprint is E137 799D 0FCC 4F75 16D1 069B D521 7721 4757 75C0
To claim this, I am signing this object:
# This script sets Google Talk (Jabber/XMPP) SRV records for DigitalOcean
# domains.
#
# To verify that your records are correct, you can query your domain's records
# like so:
#
# dig +short srv _xmpp-server._tcp.yourdomain.com
#
# (If your WHOIS information does not yet point to DigitalOcean's DNS servers,
# you need to add @ns1.digitalocean.com to the arguments to dig.)
@jmk
jmk / paypal2ofx.py
Last active April 9, 2020 13:42 — forked from russss/paypal2ofx.py
import csv
import sys
from collections import namedtuple
rows = csv.reader(sys.stdin)
fields = [field.strip().lower().replace(' ', '_').replace('/', '_')
for field in rows.next() if field.strip() != '']
PaypalRecord = namedtuple('PaypalRecord', fields)
@jmk
jmk / disqus.css
Created October 17, 2012 17:01 — forked from jingyuan/disqus.css
disqus css theme
#dsq-global-toolbar
.dsq-clearfix {
display: none;
}
#dsq-comments-title h3 {
}
#disqus_thread {
width: 730px !important;
@jmk
jmk / gist:3906464
Created October 17, 2012 16:18
Example of showing different context menu for items in a QTreeWidget (with QItemDelegate)
#include <QApplication>
#include <QItemDelegate>
#include <QMenu>
#include <QMouseEvent>
#include <QTreeWidget>
#include <QTreeWidgetItem>
// Qt documentation states that user types should begin at this value.
static const int ItemType1 = QTreeWidgetItem::UserType;
static const int ItemType2 = QTreeWidgetItem::UserType + 1;
@jmk
jmk / example.cpp
Created October 17, 2012 15:48
Example of showing different context menu for items in a QTreeWidget
#include "main.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
MyTreeWidget w;
w.show();
#include "SDL.h"
#include <stdlib.h>
#include <math.h>
struct Rect
{
Rect() : x0(0), y0(0), x1(0), y1(0) {}
Rect(double a0, double b0, double a1, double b1) :
x0(a0), y0(b0), x1(a1), y1(b1) {}