This file contains 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
#!/bin/bash | |
read -p "Enter yubikey: " key | |
echo | |
curl "http://api.yubico.com/wsapi/2.0/verify?id=87&timeout=8&sl=50&nonce=askjdnkajsndjkasndkjsnad×tamp=1&otp=$key" |
This file contains 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 flask import Module, request, redirect, url_for, render_template, abort | |
from formalchemy import FieldSet | |
from example import db | |
from example import Service, User, Forum, Category, Topic, Post | |
mod = Module(__name__) | |
models = { |
This file contains 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
;; Lingua::EN::Syllable::syllable() estimates the number of syllables in | |
;; the word passed to it. | |
;; Note that it isn't entirely accurate... it fails (by one syllable) for | |
;; about 10-15% of my /usr/dict/words. The only way to get a 100% accurate | |
;; count is to do a dictionary lookup, so this is a small and fast alternative | |
;; where more-or-less accurate results will suffice, such as estimating the | |
;; reading level of a document. | |
;; I welcome pointers to more accurate algorithms, since this one is |
This file contains 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
/** | |
* guessit | |
* Itty-bitty mastermind type game. | |
* | |
* OBJECT: | |
* | |
* The object of the game is to guess what the computer has choosen. | |
* | |
* The computer starts out by randomly selecting a number of symbols. Your job | |
* is to figure out what the symbols are. You have a limited number of |
This file contains 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
;; Deriving something like generators, but I didn't really feel like | |
;; doing exactly that. | |
;; It doesn't, for instance, support sending back into the generator | |
;; This applys a function across a range from 0 to x. | |
(define (apply-to-range f i x) | |
(when (< i x) | |
(f i) | |
(apply-to-range f (+ 1 i) x))) |
This file contains 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
# wtf8.py | |
import codecs | |
def encode(input, errors='strict'): | |
return input.encode('utf-8', errors).decode('latin-1', errors).encode('utf-8', errors), len(input) | |
def decode(input, errors='strict'): | |
return input.decode('utf-8', errors).encode('latin-1', errors).decode('utf-8', errors), len(input) | |
class StreamWriter(codecs.StreamWriter): |
This file contains 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 python | |
""" | |
Add php-serve.py to your PATH, then, from whatever directory is the root | |
of your PHP application, just run: | |
$ php-serve.py | |
You can optionally specify a port number as an argument. By default, | |
port 8000 is used: |
This file contains 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
///////////////////// unit tests | |
unsigned g_test_count; // count of number of unit tests executed | |
unsigned g_fault_count; // count of number of unit tests that fail | |
template <typename T1, typename T2> | |
void test_equal_(const T1 & value, const T2 & expected_value, const char * file, int line) | |
{ | |
++g_test_count; | |
if (value != expected_value) { |
This file contains 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
;; Let's you do this: | |
;; | |
;; (make-css | |
;; '(("body.loading" | |
;; (font-size "12px") | |
;; (color "#fff") | |
;; (" ul#sidenav" | |
;; (" li" | |
;; (blah "blah")))))) | |
;; |
OlderNewer