Skip to content

Instantly share code, notes, and snippets.

@zupzup
zupzup / main.go
Created March 20, 2017 10:03
Go TCP Proxy / Port Forwarding Example (https://zupzup.org/go-port-forwarding/)
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
"os/signal"

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

radare2

load without any analysis (file header at offset 0x0): r2 -n /path/to/file

  • analyze all: aa
  • show sections: iS
  • list functions: afl
  • list imports: ii
  • list entrypoints: ie
  • seek to function: s sym.main
@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@ddennedy
ddennedy / dash-avc264 command lines
Last active July 27, 2022 03:44
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@elithrar
elithrar / use.go
Last active January 5, 2023 11:19
go/use: Little middleware chains that could. Inspired by comments here: https://github.com/gorilla/mux/pull/36
r := mux.NewRouter()
// Single handler
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging)
// All handlers
http.Handle("/", recovery(r))
// Sub-routers
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json}
@rothgar
rothgar / gist:7131900
Created October 24, 2013 05:37
Ansible one liners
###Deploy SSH key to ansible inventory###
for server in $(ansible --list-hosts all); do ssh-copy-id -i ~/.ssh/id_rsa.pub $server; done
@dankrause
dankrause / _hover_example.py
Last active March 8, 2024 18:31
Example code to use the (unofficial, unsupported, undocumented) hover.com DNS API.
import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/api/login", params=params)