Skip to content

Instantly share code, notes, and snippets.

@hostmaster
hostmaster / nginx.conf
Created Mar 7, 2012
nginx post-action
View nginx.conf
location ^~ /attachments/download_zip/ {
proxy_pass http://mongrel;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_Forwarded_Proto $scheme;
proxy_read_timeout 120;
proxy_connect_timeout 120;
post_action @notify_zip
@nvk
nvk / osx-hack.sh
Last active Oct 27, 2021 — forked from erikh/hack.sh
OSX For Hackers & Other fixes
View osx-hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@tetsuok
tetsuok / answer_exercise_gotour.go
Created Apr 2, 2012
An answer of the exercise: Loops and Functions on a tour of Go
View answer_exercise_gotour.go
package main
import (
"fmt"
"math"
)
const Delta = 0.0001
func isConverged(d float64) bool {
@jugyo
jugyo / gist:3882497
Created Oct 13, 2012
nginx + ngx_lua on Mac
View gist:3882497
View gist:8011208
David Heinemeier
Gihub:
• 14 repos related to Ruby
• multiple comments in rails/rails
RubyGem
• 23 Gems
• 227,964,383 downloads
Vimeo
• Uploaded RubyConf video
37Signals
@mokevnin
mokevnin / routes.erl
Created Dec 23, 2013
naming routes for cowboy
View routes.erl
-module(routes).
-export([compile/0, generate_path/2, generate_url/3]).
compile() ->
List = [root, games, game, start_game],
cowboy_router:compile([
%% {URIHost, list({URIPath, Handler, Opts})}
{'_', [route(Name) || Name <- List]}
]).
@kirs
kirs / gist:8180501
Last active Jan 1, 2016
ruby noname podcast: конкурс
View gist:8180501

Конкурс на лучший вклад в Open Source от Ruby Noname подкаста

Задача — за новогодние праздники сделать максимально полезный PR в какой-либо известный проект на Гитхабе (например, закрыть известный баг или реализовать долгожданную фичу).

Принимаются пулреквесты на любые проекты, примеры проектов перечислены ниже. Победитель получит возможность бесплатно посетить мастер-класс по разработке на Rails Brainwashing c 18 по 21 января.

Конкурс продлится с момента выхода подкаста до 12 января. Мы опубликуем результаты на следующий день, 13 января.

Работы принимаются в комментариях к этому гисту.

View howsmytls.rb
require "net/https"
require "uri"
require 'json'
uri = URI.parse("https://www.howsmyssl.com/a/check")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
resp = JSON.parse(http.request(Net::HTTP::Get.new(uri.request_uri)).body)
puts JSON.pretty_generate(resp)
View compile-nginx.sh
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@jgrahamc
jgrahamc / quic-cleanup.pl
Created Feb 17, 2014
Script to take the files generated by wget -mkp --save-headers and remove headers that confuse quic_server and at the X-Original-Url header.
View quic-cleanup.pl
# quic-cleanup.pl
#
# When running the Google experimental quic_server it expects to find
# sites to serve in /tmp/quic-data. Under that there will be a
# directory per site.
#
# For example this was used to mirror the CloudFlare web site for
# QUIC testing.
#
# mkd