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
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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
test |
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 bash | |
COLUMNS=$(tput cols) | |
echo $COLUMNS | |
for i in $(seq 0 $((COLUMNS - 2))) | |
do | |
echo -ne "\033[2K\r" | |
echo -n "[" | |
yes = | head -n $i | tr -d "\n" | |
if [ $((COLUMNS - 2 - i)) != 0 ] | |
then |
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 bash | |
COLUMNS=$(tput cols) | |
for i in $(seq 1 $((COLUMNS - 2))) | |
do | |
echo -ne "\033[2K\r" | |
echo -n "[" | |
yes = | head -n $i | tr -d "\n" | |
if [ $((COLUMNS - 2 - i)) != 0 ] | |
then | |
yes " " | head -n $((COLUMNS - 2 - i)) | tr -d "\n" |
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
GetKSamples(stream S, int k): | |
samples = list of length k // samples is the list we'll return | |
for i gets 1...k: | |
samples[i] = next item in S // Add the first five items in the | |
// stream to samples | |
l <- k // Count of things seen so far | |
while S is not done | |
x <- next item in S | |
l <- l+1 // Increment count | |
if Random(l) <= k // With 5/l probability... |
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
# Clears all iTerm scrollback | |
# Useful to run before commands with long output | |
# (simply scroll to top to find beginning of output) | |
c () { | |
echo "\033]50;ClearScrollback\x7" | |
} |
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
Dogs are cute | |
It is a myth that dogs are color blind | |
Dogs DO have better low-light vision than humans because of a special light-reflecting layer behind their retinas | |
A German Shepherd guide dog led her blind companion the entire 2100 mile Appalachian Trail | |
If never spayed or neutered, a female dog, her mate, and their puppies could produce over 66,000 dogs in 6 years! | |
Dogs’ only sweat glands are between their paw pads | |
Like human babies, Chihuahuas are born with a soft spot in their skull which closes with age | |
The breed Lundehune has 6 toes and can close its ears | |
Teddy Roosevelt’s dog, Pete, ripped a French ambassador’s pants off at the White House | |
President Lyndon Johnson had two beagles named Him and Her |
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 * | |
import random | |
import json | |
app = Flask(__name__) | |
@app.before_request | |
def before_request(): | |
raw_text = open('facts.txt').read() | |
g.facts = raw_text.split('\n') |
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
/* File: simp3.k */ | |
requires "arithbool.k" | |
module SIMP3-SYNTAX | |
imports ARITHBOOL-SYNTAX | |
imports ARITHBOOL-SEMANTICS | |
/* | |
ARITHBOOL-SYNTAX introduces (variable free) arithmetic and boolean |
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
server { | |
listen 80; | |
server_name wiki.shroba.io w; | |
client_max_body_size 15M; | |
client_body_buffer_size 128k; | |
root /usr/share/nginx/www/wiki; | |
index doku.php; | |
OlderNewer