Skip to content

Instantly share code, notes, and snippets.

@firstrow
firstrow / count.rb
Created December 16, 2016 13:47
active record count queries
def count_queries(&block)
p "--------- Start Count SQL -----------"
count = 0
counter_f = ->(name, started, finished, unique_id, payload) {
unless payload[:name].in? %w[ CACHE SCHEMA ]
count += 1
end
}
ActiveSupport::Notifications.subscribed(counter_f, "sql.active_record", &block)
count
@firstrow
firstrow / .vimperatorrc.local.vim
Created September 27, 2016 14:30 — forked from igal/.vimperatorrc.local.vim
My Vimperator configuration
"===[ Settings ]========================================================
" Autocomplete using Firefox Awesomebar subsystem
set complete=l
" Show completions as you type? '' waits for tab, 'auto' shows them immediately
set wildoptions=''
" Select the longest autocomplete match
set wildmode='list:full'
http://loicpefferkorn.net/2015/01/arch-linux-on-macbook-pro-retina-2014-with-dm-crypt-lvm-and-suspend-to-disk/
http://codylittlewood.com/setting-up-an-external-monitor-on-macbook-pro-running-arch-linux-and-awesomewm/
http://vincent.jousse.org/en/tech/archlinux-retina-hidpi-macbookpro-xmonad/
http://snakeccnote.blogspot.com/2016/02/hidpi-arch-linux-macbook-pro-awesome-wm.html
http://pedronveloso.com/running-arch-linux-on-macbook-13-2015/
https://mchladek.me/post/arch-mbp/
https://vec.io/posts/use-arch-linux-and-xmonad-on-macbook-pro-with-retina-display
/server add <name> <team>.irc.slack.com/6667 -ssl -password=<password> -ssl_verify=off -nicks=<username>
/connect <name>
@firstrow
firstrow / orhttp_example.go
Created June 14, 2016 20:23 — forked from Yawning/orhttp_example.go
How to dispatch HTTP requests via Tor in Go.
// To the extent possible under law, the Yawning Angel has waived all copyright
// and related or neighboring rights to orhttp_example, using the creative
// commons "cc0" public domain dedication. See LICENSE or
// <http://creativecommons.org/publicdomain/zero/1.0/> for full details.
package main
import (
// Things needed by the actual interface.
"golang.org/x/net/proxy"
@firstrow
firstrow / app.conf
Created November 19, 2015 14:47
golang app upstart
# Upstart Configuration
description "Golang Web App"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@firstrow
firstrow / api.go
Last active October 14, 2015 17:24
Sample API
func main() {
app := NewApplication("development.toml")
app.Start(":8080")
}
type Application struct {
Config *tomlConfig
PagesController *ControllerInterface
PagesStorage *StorageInterface
UsersStorage *StorageInterface
@firstrow
firstrow / es.sh
Last active August 29, 2015 14:18 — forked from Globegitter/es.sh
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@firstrow
firstrow / helm-mini
Created March 19, 2015 08:31
Helm mini
(setq helm-display-header-line nil) ;; t by default
(set-face-attribute 'helm-source-header nil :height 0.1)
(helm-autoresize-mode 1)
(setq helm-autoresize-max-height 30)
(setq helm-autoresize-min-height 30)
(setq helm-split-window-in-side-p t)
@firstrow
firstrow / gist:76fa235654ef991ae3cf
Last active August 29, 2015 14:12
php: construct
<?php
namespace Core\Db;
/**
* Helps to iterate over huge data collection.
* It loads records by small chunks
*
* Example:
* <pre>