Skip to content

Instantly share code, notes, and snippets.

View tonetheman's full-sized avatar

Tony Colston tonetheman

View GitHub Profile
-- Author: Michael-Keith Bernard
-- Date: August 10, 2012
--
-- Notes: This Trie implementation is a port of the Clojure implementation
-- below. I had to implement quite a few functions from clojure.core to keep the
-- same basic functionality. Probably very little if any of this code is
-- production worthy, but it's interesting all the same. Finally, all of the
-- documentation strings are pulled directly from clojure.core and may not
-- accurately reflect the Lua implementation.
--
@tonetheman
tonetheman / pids.bash
Created September 17, 2013 16:20
bash command to trace leaking redis connections in node, used in debugging node and redis!
# get a list of processes first
# grep for node
# grep to remove the grep lines
# print the pids
# awk -vORS=, starts awk and sets the record separator to be the ","
# the print $1 just prints the stuff piped in (each pid in this case)
# the sed at the end takes the trailing comma ,$ and puts a return
# change the sed to 's/,$//' to just remove it and not put the return
# got the idea for the comma list grep from here
@tonetheman
tonetheman / link_list.lua
Last active December 23, 2015 11:39
some lua testing a map function and a linked list, saw this in another lang on this site http://www.braveclojure.com/core-functions-in-depth/
@tonetheman
tonetheman / test.py
Created September 23, 2013 19:53
win7x64 FF22 screenshot APIv2
# pound at the front of a line is a comment
# just making sure you know!
# your string
link_address_string = "http://www.sciencedirect.com/science/article/pii/B9780122197406500009/pdfft?md5=a05b1f606da85a80419c6fd7d5f614bf&pid=3-s2.0-B9780122197406500009-main.pdf"
# did not really need this
import urllib
# API stuff
@tonetheman
tonetheman / PortCheck.java
Created November 13, 2013 15:00
port checking in java nothing fancy
import java.net.Socket;
public class PortCheck {
int port = -1;
public void info(String s) {
System.out.println("INFO: " + s);
}
public void err(String s) {
"""
$ pip install opml
$ python opml_to_markdown.py some_outline.opml
-> some_outline.md
"""
import codecs
import opml
import sys
from passlib.context import CryptContext
pwd_context = CryptContext(
schemes = ["sha512_crypt"],
default = "sha512_crypt",
all__vary_rounds = 0.1,
pbkdf2_sha256__default_rounds = 8000,
)
def make_some_hash():
The Challenge
-------------
Given the following riddle, write a regular expression describing all possible answers,
assuming you never make a move which simply undoes the last one you made.
The Riddle
----------
You are on your way somewhere, taking with you your cabbage, goat, and wolf, as always.
You come upon a river and are compelled to cross it, but you can only carry one of the
three animals at a time. None of whom can swim because this isn't THAT kind of riddle.
@tonetheman
tonetheman / web-templates.py
Created March 4, 2014 17:32
simple template with web.py
import web
urls = (
"^/scale$", "Scale",
)
PAGE = """
<html>
<body>
@tonetheman
tonetheman / web-templates-jinja.py
Created March 4, 2014 18:46
web templates with jinja2 looks more like what i would expect
import web
import jinja2
urls = (
"^/scale$", "Scale",
)
PAGE2 = """
<html>