Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile
@priithaamer
priithaamer / gist:1034070
Created June 19, 2011 11:01
Capistrano task to ask confirmation before deploying to production
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
@hotchpotch
hotchpotch / unicorn_killer.rb
Created October 3, 2011 08:11
Unicorn process killer utility
# # your config.ru
# require 'unicorn_killer'
# use UnicornKiller::MaxRequests, 1000
# use UnicornKiller::Oom, 400 * 1024
module UnicornKiller
module Kill
def quit
sec = (Time.now - @process_start).to_i
warn "#{self.class} send SIGQUIT (pid: #{Process.pid})\talive: #{sec} sec"
@authorNari
authorNari / gist:1273387
Created October 9, 2011 06:53
rubyconf2011 note
OK, Let's begin. Hello, Everybody.
My name is Narihiro Nakamura.
Today, I'm talking about "Parallel worlds of CRuby's GC".
I'm very happy now, because I'm meeting attendee in rubyconf.
And, one of my dreams is to talk in rubyconf.
So, I'm very happy and exciting.
Today is my first presentation in English.
My English is not good.
@jboner
jboner / latency.txt
Last active May 3, 2024 01:00
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
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 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 2, 2024 03:13
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@robertsosinski
robertsosinski / trigger.sql
Created November 12, 2012 02:51
Make a table readonly in Postgres
create trigger trades_readonly_trigger before insert or update or delete or truncate on trades for each statement execute procedure readonly_trigger_function();

Typographic glyphs

via

Shortcuts and proper use

name glyph mac other description
curly single quotes ‘ ’ Option+] and Shift+Option+] ALT-0145 and ALT-0146 hover for description
curly double quotes “ ” Option+[ and Shift+Option+[ ALT-0147 and ALT-0148 -
@jdickey
jdickey / findbreaks.rb
Created May 26, 2013 16:28
FindBreaks - find and list all spec files that broke due to your world-changing one-liner just now.
#!/usr/bin/env ruby
# findbreaks 0.9
# Script to find all spec files in an `rspec` run that report errors and produce
# a list of all failed spec filenames, with each such listed once. Useful if you
# have numerous specs that break due to a world-changing edit you've just made,
# and you want a nice list of the broken specs without having to read through
# hundreds of lines of RSpec bleeding on your terminal. Pick one; fix it; run
# this again; repeat.
#
@marianposaceanu
marianposaceanu / vim_tips.md
Last active December 20, 2015 05:29
Just random VIM tips

VIM Tips

Record a sequence

Use q + [lowercase letter to name the macro] then do stuff and when done q and @a or 22@a to repeat.

Advanced search and replace

s:url("../images/\(.*\)");:url("<%= asset_path '\1' %>");:gi