Skip to content

Instantly share code, notes, and snippets.

View JT5D's full-sized avatar
💭
Multiversing...

JT5D JT5D

💭
Multiversing...
View GitHub Profile
import urllib2
import threading
from Queue import Queue
import sys, os, re
class ThreadedDownload(object):
REGEX = {
'hostname_strip':re.compile('.*\..*?/', re.I)
}
# --------------------------------------------------------------------
# An implementation of the "Growing Tree" algorithm. This one is
# notable for it's ability to become nearly identical to Prim's
# algorithm, or the Recursive Backtracking algorithm, depending on
# how the cells are removed from the list that aggregates as the
# algorithm runs.
#
# This script allows you to play with those settings by specifying
# the mode after the width and height parameters, as "random" (pull
# the cell from list at random), "newest" (pull the newest cell),
@JT5D
JT5D / sql.sql
Created October 14, 2013 08:30 — forked from licson/ sql.sql
-- phpMyAdmin SQL Dump
-- version 3.5.8.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jun 14, 2013 at 08:39 AM
-- Server version: 5.6.11-log
-- PHP Version: 5.4.14
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
#!/bin/bash
#
# Config
#
# if more than the threshold, the IP will be banned
THRESHOLD=100
# search this many recent lines of the access log
"""
Read a CSV file and save it as a JSON file. Based on
http://stackoverflow.com/questions/12951337/csv-file-to-json-file-in-python
The `data.csv`, here is a sample file from:
http://www.ferc.gov/docs-filing/eqr/soft-tools/sample-csv/contract.txt
"""
import csv
import json

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt

JS Testing

About:

@JT5D
JT5D / paper.py
Created November 4, 2013 04:22 — forked from bradmontgomery/paper.py
"""
Folding paper in half 50 times is 3/4 of the distance from earth to sun
From:
http://www.quora.com/What-are-some-of-the-most-mind-blowing-facts#answer_526501
Thickness of a sheet of paper: 0.1 mm (~0.004 inches)
"""
@JT5D
JT5D / crontab
Created November 4, 2013 04:40 — forked from bradmontgomery/crontab
#X-------------------- minute (0 - 59)
#--X------------------ hour (0 - 23)
#-----X--------------- day of month (1 -31)
#-------X------------- month (1-12)
#----------X---------- day of week (0-7) (sunday = 0 or 7)