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
| -- 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. | |
| -- |
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
| # 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 |
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
| local LL = {} -- class object | |
| function LL.new(val) | |
| local self = {} | |
| self.value = val | |
| self.next = nil | |
| function self:first() | |
| return self.value | |
| end |
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
| # 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 |
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 java.net.Socket; | |
| public class PortCheck { | |
| int port = -1; | |
| public void info(String s) { | |
| System.out.println("INFO: " + s); | |
| } | |
| public void err(String s) { |
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
| """ | |
| $ pip install opml | |
| $ python opml_to_markdown.py some_outline.opml | |
| -> some_outline.md | |
| """ | |
| import codecs | |
| import opml | |
| import sys |
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
| 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(): |
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
| 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. |
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 web | |
| urls = ( | |
| "^/scale$", "Scale", | |
| ) | |
| PAGE = """ | |
| <html> | |
| <body> |
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 web | |
| import jinja2 | |
| urls = ( | |
| "^/scale$", "Scale", | |
| ) | |
| PAGE2 = """ | |
| <html> |