Skip to content

Instantly share code, notes, and snippets.

@amaudy
amaudy / Raspberry Pi httpd benchmark.md
Created February 19, 2016 07:52 — forked from msoap/Raspberry Pi httpd benchmark.md
Raspberry Pi httpd benchmark with wrk

Raspberry Pi httpd benchmark

Total RPS

All:

               Go/fasthttp (10 thr): 930.0 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

Nginx (10 thr): 826.1 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

@amaudy
amaudy / copy-key.md
Created December 23, 2015 10:53
Copy public key to server

cat ~/.ssh/id_rsa.pub | ssh -i [email protected] 'cat >> .ssh/authorized_keys && echo "Key copied"'

@amaudy
amaudy / node-nginx.conf
Created November 1, 2015 06:23
Vhost setup for Node app
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:1337; # forward to node app
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
@amaudy
amaudy / gist:1ac6db3858de7b2e6d83
Last active October 31, 2015 18:14
Error install Pillow

Got some error when install Pillow

ValueError: --enable-jpeg requested but jpeg not found

I giveup for Python 3 then setup again with Python 2 because it need libjpeg-dev

sudo apt-get install libjpeg-dev
@amaudy
amaudy / start-sidekiq.md
Created October 28, 2015 03:48
start Sidekiq
bundle exec sidekiq -d -L sidekiq.log -q mailer,5 -q default -e production
@amaudy
amaudy / latest_revision.rb
Created September 30, 2015 06:14
Get latest revision that deployed.
# put this snippet to config/deploy.rb
# then call via Capistrano Rake task
# bundle exec cap staging latest_revision
desc "View latest commit that deploy on server"
task :latest_revision, :roles => :app do
trap("INT") { puts 'Interupted'; exit 0; }
run "cat #{deploy_to}/current/REVISION" do |channel, stream, data|
puts
puts "******* REVISION ********"
@amaudy
amaudy / chrome-ubuntu-apt-get.md
Created September 2, 2015 03:35
Install Google Chrome on Ubuntu via apt-get
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@amaudy
amaudy / deploy.rb
Created January 20, 2015 09:52
locally precompile assets
# namespace :deploy do
# task :default do
# update
# assets.precompile
# restart
# cleanup
# # etc
# end
# end
@amaudy
amaudy / hook_get_p.php
Created November 10, 2014 06:05
hook wordpress $_GET
<?php
// Let say you want to do something with affid in http://mysite.com/about/?affid=1234
add_action('init', 'affiliate_redirect');
function affiliate_redirect() {
$varname = 'aff_id';
$weeks = '4';
if( isset($_GET[$varname]) && '' != $_GET[$varname] ) {
setcookie('wp_affiliate', $_GET[$varname], time()+648000*$weeks, '/');