Skip to content

Instantly share code, notes, and snippets.

View md2k's full-sized avatar
:octocat:
go-ing...

Yevgen Flerko md2k

:octocat:
go-ing...
View GitHub Profile
@md2k
md2k / tmux-cheatsheet.markdown
Created March 24, 2016 11:04 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@md2k
md2k / revprox.go
Created May 3, 2016 14:33 — forked from JalfResi/revprox.go
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@md2k
md2k / sysctl.conf
Created May 25, 2016 08:21 — forked from kfox/sysctl.conf
Linux kernel tuning settings for large number of concurrent clients
# 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
@md2k
md2k / log.go
Created June 13, 2016 16:17 — forked from cespare/log.go
Golang apache logging
type ApacheLogRecord struct {
http.ResponseWriter
ip string
time time.Time
method, uri, protocol string
status int
responseBytes int64
elapsedTime time.Duration
}
@md2k
md2k / log.go
Created June 14, 2016 10:30 — forked from Tantas/log.go
Apache access logs for golang.
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"
@md2k
md2k / concurrency-in-go.md
Created September 2, 2016 08:08 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy
@md2k
md2k / rtmp_loop.c
Created October 10, 2016 18:05 — forked from nxtreaming/rtmp_loop.c
A simple service to loop RTMP VOD streaming
/*
* loop_rtmp.c: A simple service to loop RTMP VOD streaming
*
* Usage:
* loop_rtmp <playlist> <channel>
*
*/
#include <unistd.h>
#include <stdint.h>
@md2k
md2k / gist:d883de890ed1e974d9f9a5fc13913292
Created December 23, 2016 12:26 — forked from anonymous/gist:80fb467852c2c71a5168
Add wp_termmeta table to WordPress database
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' );
/**

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@md2k
md2k / parse_json.go
Created March 14, 2018 15:05 — forked from mjohnsullivan/parse_json.go
Parse JSON objects with arbitrary key names in Go using interfaces and type assertions
// 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"
)