Skip to content

Instantly share code, notes, and snippets.

View drbig's full-sized avatar

Piotr Staszewski drbig

View GitHub Profile
@drbig
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 = '127.0.0.1', port = '9123')
@where = where
@host = host
@drbig
drbig / hello_world.rb
Last active August 29, 2015 14:10
Hello world with c64asm
hello_world = AsmMacro.new do
jsr 0xe544 # clear
ldx.d 0
label :read
lda.ax :msg
cmp.d 35
beq :finish
jsr 0xffd2 # chrout
inx
jmp :read
@drbig
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
[0-9a-zA-Z]{2}
30-39,41-5a,61-7a
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
drbig / pr.md
Last active August 29, 2015 14:26 — forked from piscisaureus/pr.md
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 = git@github.com:joyent/node.git

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:

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
drbig / multiple_ssh_setting.md
Created October 29, 2015 10:26 — forked from jexchan/multiple_ssh_setting.md
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 "your_email@youremail.com"
@drbig
drbig / Description.md
Created July 11, 2016 16:52 — forked from juanje/Description.md
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
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 https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- 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