Skip to content

Instantly share code, notes, and snippets.

@wallrat
wallrat / proxy.go
Created July 6, 2012 11:25
Simple GO TCP proxy
package main
import (
"net"
"fmt"
"io"
"os"
)
func main() {
if len(os.Args) != 3 {
fatal("usage: netfwd local remote")
@wallrat
wallrat / React-dashboard.markdown
Created January 7, 2014 15:03
A Pen by Andreas Bielk.
@wallrat
wallrat / six-sdk-memoized.js
Last active February 17, 2017 09:23
Wrapping the six-sdk connect() to memoize sessions
import sdk from 'six-sdk'
let cachedSession
let cachedToken
export default {
connect: (token) => {
if (token === cachedToken) {
return cachedSession
}
@wallrat
wallrat / hitch.rb
Created October 29, 2016 17:58
Homebrew brew formula for Varnish'es Hitch TLS Proxy Server
class Hitch < Formula
desc "A scalable TLS proxy by Varnish Software"
homepage "https://github.com/varnish/hitch"
url "https://github.com/varnish/hitch/archive/hitch-1.3.0-beta2.tar.gz"
sha256 "fbec6197a77c54f23e941cf0fcecbb8f6c24086ebe2c45467d30b330a370fe90"
head "https://github.com/varnish/hitch.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "pkg-config" => :build
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
@wallrat
wallrat / LoadTexture.cs
Created May 2, 2016 06:09
Load a unity texture from internet
private IEnumerator FetchSprite(string imageURL)
{
//create a www instance
WWW www = new WWW(imageURL);
//build a new texture
Texture2D tex = new Texture2D(1, 1, TextureFormat.ARGB32, false);
//set filter mode to point (pixel art)
tex.filterMode = FilterMode.Point;
@wallrat
wallrat / jsbin.ENILAqEY.coffee
Last active January 2, 2016 14:39 — forked from anonymous/jsbin.ENILAqEY.coffee
Experimental glue code for using React components in AngularJS apps.
reactModule = angular.module 'react',[]
#
# Usage <div react-attach={{React class}} react-prop-{{React prop}}={{angular scope expression}}* />
#
reactModule.directive 'reactAttach', ->
return {
restrict: 'A'
link: (scope,element,attrs) ->
# get React component construnctor fn
@wallrat
wallrat / proxy.go
Created July 6, 2012 11:24 — forked from vmihailenco/proxy.go
Redis proxy
package main
import (
"flag"
"io"
"log"
"net"
"os"
"os/signal"
"runtime/pprof"
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
package scratch;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.UUID;