Skip to content

Instantly share code, notes, and snippets.

View AlekSi's full-sized avatar
🕊️

Alexey Palazhchenko AlekSi

🕊️
View GitHub Profile
@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
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@scottjacobsen
scottjacobsen / git+clone+ssh+agent+forward+sudo
Created December 14, 2012 00:07
Git clone using ssh agent forwarding and sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
@acolyer
acolyer / service-checklist.md
Last active January 30, 2024 17:39
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@coordt
coordt / check_for_updates.py
Created April 8, 2011 18:39
Check locally installed packages against one or more package indexes for updates and list them.
#!/usr/bin/env python
"""
Use pip to get a list of local packages to check against one or more package
indexes for updated versions.
"""
import pip
import sys, xmlrpclib
from cStringIO import StringIO
from distutils.version import StrictVersion, LooseVersion
@bikbah
bikbah / .go
Last active May 11, 2016 11:31
package main
import (
"encoding/xml"
"testing"
)
type (
Int int
String string
@nevir
nevir / README.md
Last active December 15, 2015 01:49
README-driven project metadata

Package Name (1.2.3)

Short package description; useful for quick one-liners when displaying information about it on various sites/contexts.

Normal Readme Stuff

Blah, blah blah. The order of readme sections doesn't matter: organize it however you like.

@jimweirich
jimweirich / README.md
Created December 12, 2011 02:28
Description of a Refactoring Kata

Refactoring Kata

Here's an interesting refactoring challenge.

Refactor the tangle.c program described at http://axiom-developer.org/axiom-website/litprog.html with the goal of making it more readable and maintainable.

Some suggested guidelines and constraints. Of course, you can do

@AlekSi
AlekSi / update.rb
Created August 21, 2011 15:20
Update all gems, packages, fetch all code, etc.
#! /usr/bin/env ruby
STDOUT.sync = true
STDERR.sync = true
def run(cmd, *ok_statuses)
puts "\n=========> #{cmd}"
system(cmd)
unless ([0] + ok_statuses).include?($?)
puts "Exit status: #{$?}"
@AlekSi
AlekSi / gist:1154108
Created August 18, 2011 13:53
MongoDB benchmark for Graylog2
count = 10000
size = 100 // megabytes
hosts = ['host1', 'host2', 'host3', 'host4', 'host5']
facilities = ['Server', 'Client', 'Proxy']
chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz '.split('');
speed = 1500.0; // messages per second
start = new Date().getTime() - 24*60*60*1000;