Skip to content

Instantly share code, notes, and snippets.

View webgago's full-sized avatar
🏠
Working from home

Anton Sozontov webgago

🏠
Working from home
View GitHub Profile
@webgago
webgago / gist:4572930
Last active December 11, 2015 08:28
Setup box
sudo apt-get -y install curl git-core python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev
http://www.modrails.com/documentation/Users%20guide%20Nginx%204.0.html
http://alexpearce.me/2012/06/setting-up-a-vps/
https://raw.github.com/alexpearce/templates/master/nginx.app.conf
#!/usr/bin/env ruby
class GoodMan
require 'base64'
attr_accessor :abilities, :age, :message, :skills
YODA_VOID = ["YXNrZGZrYWtzZG9vd2VvaWtsc287c2RmaWhpc2p1c2Rma2hobmtraGthbnBv\nZnk5cDItOTM0bGtodHNkZms7bDtoc2RmbA==\n",
"bGFzc2xmbHNhZGdra2xhc2R0a2x0a2w7c25hc2xkdXpqcG9hc2RmaG92\n",
"cnVieSxqUXVlcnkscGhwLHRkZCxiZGQsc2NydW0sYWdpbGUsc3FsLGxpbnV4\nLGNzcw==\n",
@funny-falcon
funny-falcon / latency.txt
Created June 1, 2012 11:10 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@ramusus
ramusus / rails_admin.ru.yml
Created February 10, 2012 10:14
Russian translation for RailsAdmin
# Russian. Updated 2012-07-18
ru:
admin:
home:
name: "Главная"
pagination:
previous: "« Предыдущая"
next: "Следующая »"
truncate: ""
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@simonharrer
simonharrer / gist:1173228
Created August 26, 2011 11:29
Use JRuby to create a Java Soap Web Service
require 'java'
require 'jruby/core_ext'
module WS
class WebService
def test()
puts "Call received at #{Time.new}"
# x = Result.new
# x.name = "asdf"
# return x
@webgago
webgago / xml_utf8_fix.rb
Created April 1, 2011 13:30
fix russian chars in xml/rss builder
class Fixnum #:nodoc:
XChar = Builder::XChar unless defined?(XChar)
# XML escaped version of chr (inlines cyrillic unicode range)
def xchr
n = XChar::CP1252[self] || self
n = 42 unless XChar::VALID.find { |value| value.kind_of?(Range) ? value.include?(n) : (value == n) }
XChar::PREDEFINED[n] or case n
when 0...128
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
@mnutt
mnutt / Instrument Anything in Rails 3.md
Created September 6, 2010 06:50
How to use Rails 3.0's new notification system to inject custom log events

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1

Rendered layouts/_nav.html.erb (363.4ms)