Skip to content

Instantly share code, notes, and snippets.

View asabirov's full-sized avatar

Artur Sabrov asabirov

  • Apliteni.com
  • Spain
View GitHub Profile
@jberkus
jberkus / gist:6b1bcaf7724dfc2a54f3
Last active January 7, 2024 21:26
Finding Unused Indexes
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end

Install OpenStack on a Hetzner VQ7 server

Reinstall Ubuntu

  1. Boot the server into the 64bit Linux rescue system
  2. Run installimage
  3. Select Ubuntu 11.10 (oneiric) 64bit
  4. In the editor, where you have to set the disk partition sizes, search for following lines and remove them. The actual lines may vary if Hetzner changes anything.
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@jonavon
jonavon / CIDR.php
Created March 13, 2012 13:50
CIDR class for IPv4
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <jowilcox@vt.edu>
* @revision Carlos Guimarães <cvsguimaraes@gmail.com>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
@sandinist
sandinist / gist:1659881
Created January 23, 2012 01:38
pry iterm forward delete
-If you're using a Mac terminal, take a look at [this article](http://www.21croissants.com/howto/fix-forward-delete-key-on-snow-leopard-for-irb).
+#### iTerm2
+
+* Go to iTerm > Preferences... > Keys
+* Add a Global Shortcut Key
+* Type the `delete` key as Shortcut
+* Select Send Hex Codes as Action and type 0x004
+* Click on `OK` and you're good to go
+
+#### iTerm
@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
package
{
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLStream;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.utils.Endian;