Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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"
/server add <name> <team>.irc.slack.com/6667 -ssl -password=<password> -ssl_verify=off -nicks=<username>
/connect <name>
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
@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'
@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 / sql_logger.rb
Created January 5, 2017 15:52
Log active record SQL call line
module LogQuerySource
def debug(*args, &block)
return unless super
backtrace = Rails.backtrace_cleaner.clean caller
# logger.debug(backtrace)
relevant_caller_line = backtrace.detect do |caller_line|
!caller_line.include?('/initializers/')
end
@firstrow
firstrow / rabbitmq_reconnect.go
Created April 24, 2017 13:03 — forked from svcavallar/rabbitmq_reconnect.go
Golang example to reconnect to RabbitMQ on a connection closed event
package main
import (
"flag"
"github.com/streadway/amqp"
"log"
"time"
)
var amqpUri = flag.String("r", "amqp://guest:[email protected]/", "RabbitMQ URI")
@firstrow
firstrow / gist:392bce9ea8c00d3634479f5798ed958b
Last active June 10, 2017 08:52 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 1 > Bridged Adapter