Skip to content

Instantly share code, notes, and snippets.

Kyle Gibson kylegibson

Block or report user

Report or block kylegibson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
from bs4 import BeautifulSoup
def max_tree_height(html):
Calculate the number of HTML tag levels, iteratively
>>> max_tree_height('')
>>> max_tree_height('<div></div>')
View faked-list-scenarios.txt
## Nested lists using tabs:
1. FOO
2. FOO
[tab]a. FOO
[tab]b. FOO
[tab][tab]i. FOO
[tab][tab]ii. FOO
3. FOO
4. FOO
kylegibson / fermat.c
Created Mar 5, 2015
Fermat near miss finder
View fermat.c
Fermat Near-Miss Finder
Written by David X. Cohen
February 3, 1998, 3:24 AM.
This program generated the equation:
3987^12 + 4365^12 = 4472^12
kylegibson /
Created Jul 31, 2014
Unicode issue with urllib quote and unquote
from urllib import unquote, quote
a = u'\u2022'
print a
b = a.encode('utf-8')
print b
c = quote(b)
print c
from urllib2 import quote, unquote
import sqlite3
def fix_the_things(name):
name = name[6:]
name = quote(unquote(name), '-_.!()')
name = name.replace('.rar%2F', '.rar/')
bits = name.split('%')
res = [bits[0]]
from decorator import decorator
from line_profiler import LineProfiler
def profile_each_line(func, *args, **kwargs):
profiler = LineProfiler()
profiled_func = profiler(func)
profiled_func(*args, **kwargs)
#!/usr/bin/env python
""" v0.2
Filter relocated lines from a unified diff format stream.
Offered under the terms of the MIT License at
Taken from
import sys
from optparse import OptionParser
kylegibson /
Last active Oct 11, 2015 — forked from jlward/
Configure Jenkin slave
main() {
configure_ssh_known_hosts() {
echo configuring ssh known hosts
kylegibson / gist:3437984
Created Aug 23, 2012
facebook-like selection style
View gist:3437984
%legend Select Users to Assign
These users or groups
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
// @include*
// @grant none
// ==/UserScript==
$(function() {
You can’t perform that action at this time.