Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
)
type WebPage struct {
<VirtualHost *:8082>
ServerAdmin [email protected]
DocumentRoot /opt/myapp
ServerName admin.example.com
# LogLevel warn
LogLevel debug
ErrorLog "|/usr/local/apache-python/bin/rotatelogs /usr/local/apache-python/logs/error_log.%Y-%m-%d-%H_%M_%S 86400"
CustomLog "|/usr/local/apache-python/bin/rotatelogs /usr/local/apache-python/logs/access_log.%Y-%m-%d-%H_%M_%S 86400" combined
@saml
saml / wgo.md
Last active January 28, 2016 17:00

Given pkg foo:

github.com/saml/foo/
  src/
    saml/
      foo/
        a.go
  .gocfg/
 gopaths
{% if user.is_authenticated and user.is_staff %}
<div id="user-tools">
{% trans 'Welcome,' %}
<strong>{% firstof user.first_name user.username %}</strong>.
{% block userlinks %}
{% url django-admindocs-docroot as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
{% endif %}
{% url admin:password_change as password_change_url %}
#!/bin/bash
if (( $# < 1 ))
then
echo "Usage: $0 git-repo [base-dir]"
exit 1
fi
giturl="$1"
gitrepo="${giturl##*://}"
@saml
saml / tree.ts
Last active January 21, 2016 20:38
class Thing {
constructor(public id: number, public parentId: number) {
}
}
/*
1
/ \
2 3
/ / \
let a = 1 // number, comment
let b int64 = 2 // wow type.
let c = "hello"
func f(a, b) =
a + b
func g(x int) int = {
c + " world!" // side effect
x + 1
─────────────────────────▄▀▄
─────────────────────────█─█
─────────────────────────█─█
─────────────────────────█─█
─────────────────────────█─█
─────────────────────────█─█
─────────────────────────█─▀█▀█▄
─────────────────────────█──█──█
─────────────────────────█▄▄█──▀█
────────────────────────▄█──▄█▄─▀█
@saml
saml / regex dos.js
Last active January 22, 2016 22:15
var REGEX = /^((a)+)+$/;
function test(n) {
var input = Array(n).join('a') + 'b';
var id = 'n='+n;
console.log(input);
console.time(id);
REGEX.exec(input);
console.timeEnd(id);
}
RewriteRule ^/foobar$ 'http://localhost:8000/?q="foo bar"' [P,L]
::1 - - [18/Dec/2015:15:37:53 --0500] [localhost/sid#1a7a968][rid#1c9e140/initial] (2) rewrite '/foobar' -> 'http://localhost:8000/?q="foo bar"'
::1 - - [18/Dec/2015:15:37:53 --0500] [localhost/sid#1a7a968][rid#1c9e140/initial] (3) split uri=http://localhost:8000/?q="foo bar" -> uri=http://localhost:8000/, args=q="foo bar"
RewriteRule ^/foobar$ 'http://localhost:8000/?q="foo%20bar"' [P,L]
::1 - - [18/Dec/2015:15:41:13 --0500] [localhost/sid#1a7a968][rid#1c5fdd0/initial] (2) rewrite '/foobar' -> 'http://localhost:8000/?q="foo0bar"'
::1 - - [18/Dec/2015:15:41:13 --0500] [localhost/sid#1a7a968][rid#1c5fdd0/initial] (3) split uri=http://localhost:8000/?q="foo0bar" -> uri=http://localhost:8000/, args=q="foo0bar"
RewriteRule ^/foobar$ 'http://localhost:8000/?q%3D%22foo%20bar%22' [P,L]