start new:
tmux
start new with session name:
tmux new -s myname
package main | |
import( | |
"log" | |
"net/url" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { |
# Kernel sysctl configuration file for Red Hat Linux | |
# | |
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and | |
# sysctl.conf(5) for more details. | |
# Controls source route verification | |
net.ipv4.conf.default.rp_filter = 1 | |
# Do not accept source routing | |
net.ipv4.conf.default.accept_source_route = 0 |
type ApacheLogRecord struct { | |
http.ResponseWriter | |
ip string | |
time time.Time | |
method, uri, protocol string | |
status int | |
responseBytes int64 | |
elapsedTime time.Duration | |
} |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"strings" | |
"time" | |
) | |
// https://httpd.apache.org/docs/2.2/logs.html#combined + execution time. | |
const apacheFormatPattern = "%s - - [%s] \"%s %s %s\" %d %d \"%s\" \"%s\" %.4f\n" |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
/* | |
* loop_rtmp.c: A simple service to loop RTMP VOD streaming | |
* | |
* Usage: | |
* loop_rtmp <playlist> <channel> | |
* | |
*/ | |
#include <unistd.h> | |
#include <stdint.h> |
function hm_add_term_meta_table() { | |
global $wpdb; | |
if ( ! current_theme_supports( 'term-meta' ) ) | |
return false; | |
hm_create_term_meta_table(); | |
$wpdb->tables[] = 'termmeta'; | |
$wpdb->termmeta = $wpdb->prefix . 'termmeta'; | |
} | |
add_action( 'init', 'hm_add_term_meta_table' ); | |
/** |
As configured in my dotfiles.
start new:
tmux
start new with session name:
// Parsing arbitrary JSON using interfaces in Go | |
// Demonstrates how to parse JSON with abritrary key names | |
// See https://blog.golang.org/json-and-go for more info on generic JSON parsing | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) |