Skip to content

Instantly share code, notes, and snippets.

View msawangwan's full-sized avatar
😎

misha sawangwan msawangwan

😎
View GitHub Profile
@xgalaxy
xgalaxy / gist:6743756
Last active April 24, 2019 08:40
Example of working with anonymous types in Unity3d
using System;
using System.Collections;
using UnityEngine;
public class Testing : MonoBehaviour
{
void Start()
{
// In C#, this is an 'Anonymous Type'
// A new System.Type is generated for it at compile type
@emersonf
emersonf / s3etag.sh
Last active May 16, 2024 12:30
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then
@dcrystalj
dcrystalj / startup.bat
Created December 12, 2013 11:12
windows conEmu startup aliases
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*
doskey ls=ls $1 --color
doskey ll=ls -la --color
doskey sbl = sublime $*
doskey sshs = ssh tom@188.230.237.133
doskey oocd = openocd-x64-0.6.1 -f .\stm32f4discovery.cfg
doskey oocd7 = openocd-x64-0.7.0 -f .\stm32f4discovery.cfg
doskey sshkey = type C:\Users\dcrystalj\.ssh\id_rsa.pub | clip & echo "ssh key in clipboard"
:: Git
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
package nettimeout
import (
"net"
"time"
)
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
@tristanwietsma
tristanwietsma / auth.go
Created May 15, 2014 04:15
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
@staltz
staltz / introrx.md
Last active June 2, 2024 11:03
The introduction to Reactive Programming you've been missing
@AkhmadMax
AkhmadMax / DetectLeaks.cs
Created July 1, 2014 11:28
Script helps to find if Unity leaves any assets in memory, what causes overflow. Usually it happens after creating assets in runtime.
// Script helps to find if Unity leaves any assets in memory, what causes overflow.
// Usually it happens after creating assets in runtime.
using UnityEngine;
public class DetectLeaks : MonoBehaviour
{
void OnGUI()
{
if (GUILayout.Button("Unload Unused Assets"))
@reterVision
reterVision / insert_pg.go
Created July 5, 2014 08:18
A trivial program that uses goroutine to insert records into Postgres.
/*
Original idea from
http://www.acloudtree.com/how-to-shove-data-into-postgres-using-goroutinesgophers-and-golang/
*/
package main
import (
"log"
"time"
"os"
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)