Skip to content

Instantly share code, notes, and snippets.

View drbig's full-sized avatar

Piotr Staszewski drbig

View GitHub Profile
drbig / psql_useful_stat_queries.sql
Created July 12, 2019 13:58 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from
--- some of them taken from
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
-- Basics --
-- Get indexes of tables
drbig /
Created July 11, 2016 16:52 — forked from juanje/
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
drbig /
Created October 29, 2015 10:26 — forked from jexchan/
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C ""

If tmux fails with the message "open terminal failed: missing or unsuitable terminal: rxvt-unicode-256color".

$ ssh remotemachine mkdir -p .terminfo/r
$ scp /usr/share/terminfo/r/rxvt-unicode* remotemachine:.terminfo/r/
drbig /
Last active August 29, 2015 14:26 — forked from piscisaureus/
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

a:61 z:7a A:41 Z:5a 0:30 9:39
MSP430 alphanumeric shellcode is hard. There's no way to write to memory,
no word-sized reg-reg operations, and all we have is add/sub/mov and a few conditional jumps.
drbig / vl.rb
Created December 8, 2014 12:50
Pipe compiler errors to it.
#!/usr/bin/env ruby
# coding: utf-8
require 'smart_colored'
STDIN.each_line do |l|
if m = l.match(%r{((/.*?)+)\:(\d+)})
fn, _, ln = m.captures
next unless File.exist? fn
ln = ln.to_i
puts m.to_s.colored.bold
drbig / hello_world.rb
Last active August 29, 2015 14:10
Hello world with c64asm
hello_world = do
jsr 0xe544 # clear
ldx.d 0
label :read :msg
cmp.d 35
beq :finish
jsr 0xffd2 # chrout
jmp :read
drbig / gist:4446871
Last active April 24, 2017 18:24
Pry session over telnet. Minimal and forking (plus a thread for the TCPServer).
drbig@swordfish:pts/16 ~/P/pry-tcprepl> cat pry-tcprepl.rb
require 'pry'
require 'pty'
class PryTcpRepl
attr_reader :thread
def initialize(where, host = '', port = '9123')
@where = where
@host = host