This file contains hidden or 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
r"""Inline python | |
USAGE | |
------ | |
`render()` compiles and renders a template, returning a string: | |
>>> render(r'Hello {{name}}!', name='World') | |
'Hello World!' | |
`compile()` compiles a template into a function for later use: |
This file contains hidden or 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/python | |
"""Converts a list of code files into a LaTeX document.""" | |
from argparse import ArgumentParser | |
import re | |
import os | |
import subprocess | |
import pygments | |
import itertools | |
import sys | |
import signal |
This file contains hidden or 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
/* This fun module implements 100% more fun and excitement in | |
* nodejs coding. | |
* | |
* Implements module reloading, code swapping, classes with C3 MRO, | |
* state saving (pickling) and loading (unpickling) and replacing. | |
* | |
* This is extracted from the bb4 source code, licensed under the MIT License. | |
* bb4 is available at <https://github.com/pyokagan/bb4> | |
* | |
* Requires node-weak to be installed. (npm install weak) |
This file contains hidden or 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.2 | |
""" | |
mozreplcurl - Wrapper around curl that adds on firefox's cookies, and updates firefox's cookie db after curl finishes running. | |
To update firefox's cookies db when firefox is running, mozrepl is required to be installed. | |
""" | |
import sys | |
import re | |
from telnetlib import Telnet | |
from argparse import ArgumentParser |
This file contains hidden or 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 urllib.request | |
from urllib.parse import urlsplit, urlunsplit, unquote | |
class ModifyUrlHandler(urllib.request.BaseHandler): | |
def __init__(self, target): | |
x = urlsplit(target) | |
self.full_url = urlunsplit(x._replace(fragment="")) | |
self.fragment = x.fragment | |
#Remove port from x.netloc if present for origin_req_host | |
self.origin_req_host = x.netloc.partition(":")[0] |
This file contains hidden or 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 urllib,hmac,time,hashlib,base64,httplib,sys,json,urlparse | |
## This is just a simple example that is self contained. | |
## You will need to modified it to make it work | |
## | |
## creds - need to be filled out | |
## blognmae - needs to be defined | |
## | |
## reads in image files from the command line and posts to your blog |
This file contains hidden or 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/python3 -u | |
"""A wrapper around oauth2curl. Makes multiple | |
calls to oauth2curl. Returns items one item | |
per line.""" | |
from argparse import ArgumentParser | |
from subprocess import Popen, PIPE | |
import sys | |
from urllib.parse import urlsplit, parse_qs, urlencode, urlunsplit | |
import json | |
import signal |
This file contains hidden or 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/python3 | |
"""Converts a list of code files into a latex document.""" | |
from argparse import ArgumentParser | |
import re | |
import os | |
from pygments.lexers import get_lexer_for_filename | |
def filter_tex(x): | |
def escape(x): |
This file contains hidden or 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/python2.6 | |
""" | |
trunc -n LENGTH -k 0,1,2,3... COMPONENTS... | |
""" | |
from __future__ import print_function,unicode_literals | |
from argparse import ArgumentParser | |
from math import floor | |
def shorten(length, x, suffix = "..."): | |
if len(x) <= length: |
This file contains hidden or 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/python2.6 | |
#NOTE: Also python3 compatible. | |
from __future__ import print_function,unicode_literals | |
import time, json, sys, re | |
from argparse import ArgumentParser | |
from telnetlib import Telnet | |
class Mozrepl: | |
def __init__(self, host="127.0.0.1", port=4242): | |
self.host = host |