Skip to content

Instantly share code, notes, and snippets.

View tweibley's full-sized avatar

Taylor Weibley tweibley

  • 37signals
  • Florida
View GitHub Profile
class UseUtf8mb4Characterset < ActiveRecord::Migration
def up
# The migration has been done following:
# - http://mathiasbynens.be/notes/mysql-utf8mb4#utf8-to-utf8mb4
# - http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-upgrading.html
database = Rails.configuration.database_configuration[Rails.env]["database"]
# Stop checking foreign keys
execute "SET foreign_key_checks = 0"
@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
@m1ari
m1ari / RPI Streaming notes
Last active January 20, 2023 13:32
Stream raspberry pi camera over multicast and cope with raspivid exiting
This requires a couple of windows (or a screen/tmux session)
First create a fifo to use
mkfifo video.h264
In the first window start raspivid in the following way
while true; do raspivid -n -vf -hf -w 460 -h 270 -b 512000 -t 36000000 -o video.h264 -v; done
In the second window start vlc like:
cvlc video.h264 --sout "#duplicate{dst=std{access=udp,mux=ts,dst=239.255.1.2:1234}}" :demux=h264 --ttl 4 -I http --sout-keep -v --loop
@tmm1
tmm1 / README.md
Created February 10, 2011 05:33
no longer requires any proxies! just replace your enhancers.js. also see https://gist.github.com/821736