Skip to content

Instantly share code, notes, and snippets.

View International's full-sized avatar
🪲
Debugging

George Opritescu International

🪲
Debugging
View GitHub Profile
require "yard"
module YARD
module Grape
def self.routes
YARD::Handlers::Grape::AbstractRouteHandler.routes
end
def self.error_handlers
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker -y
@International
International / main.go
Created October 7, 2015 11:29 — forked from mschoebel/main.go
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 60
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
@International
International / go_scp.go
Created October 22, 2015 11:15 — forked from jedy/go_scp.go
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@International
International / myappindicator_v1.py
Created December 24, 2015 07:41 — forked from candidtim/myappindicator_v1.py
Minimal set-up for an Ubuntu AppIndicator in Python
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
APPINDICATOR_ID = 'myappindicator'
def main():
indicator = appindicator.Indicator.new(APPINDICATOR_ID, 'whatever', appindicator.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(gtk.Menu())
gtk.main()
@International
International / asynctest_controller.rb
Created January 16, 2016 00:08 — forked from JulienSansot/asynctest_controller.rb
async controller in rails with Thin, EventMachine, em-synchrony, em-http-request
class AsynctestController < ApplicationController
require "em-synchrony/em-http"
def test
EventMachine.synchrony do
http = EventMachine::HttpRequest.new("https://www.google.co.uk/").get
render :json => {result: http.response}
@International
International / gdb_ruby_backtrace.py
Created March 9, 2016 22:45 — forked from csfrancis/gdb_ruby_backtrace.py
Dump an MRI call stack from gdb
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
def get_lineno(iseq, pos):
@International
International / onchange.sh
Created April 30, 2016 17:21 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of