Skip to content

Instantly share code, notes, and snippets.

View changs's full-sized avatar
💭
I may be slow to respond.

Bartosz Pranczke changs

💭
I may be slow to respond.
View GitHub Profile
@changs
changs / gist_hotspot.txt
Last active October 8, 2021 13:54
Traceroute
λ traceroute 3.67.35.217
traceroute to 3.67.35.217 (3.67.35.217), 64 hops max, 52 byte packets
1 192.168.43.1 (192.168.43.1) 5.983 ms 4.927 ms 3.919 ms
2 * * *
3 * * *
4 10.220.105.14 (10.220.105.14) 37.185 ms 48.766 ms 37.074 ms
5 wawbal-i2-be6-302.plusnet.pl (212.2.99.245) 85.548 ms 42.826 ms 39.223 ms
6 99.83.70.186 (99.83.70.186) 23.560 ms 39.159 ms 59.270 ms
7 52.93.18.211 (52.93.18.211) 35.402 ms
52.93.18.201 (52.93.18.201) 37.268 ms
@changs
changs / lua
Last active July 6, 2017 17:28
wifi.setmode(wifi.STATION)
wifi.sta.config("nazwawifi","haslo")
wifi.sta.connect()
tmr.delay(1000000)
print(wifi.sta.status())
print(wifi.sta.getip())
tmr.alarm(0, 400000, 1, function ()
require 'ds18b20'
@changs
changs / hist
Created January 15, 2017 12:56
#!env ruby
require 'date'
from = Date.new(*ARGV[1].split(',').map(&:to_i)).to_time.to_i
to = Date.new(*ARGV[2].split(',').map(&:to_i)).to_time.to_i
File.open(ARGV[0]).each_line do |line|
/: (?<timestamp>\d+)/ =~ line rescue next
puts line if timestamp.to_i.between?(from, to)
end
@changs
changs / flip.rb
Last active February 27, 2016 15:45
❯ cat flip.rb
require 'benchmark/ips'
DAYS = [:mon, :tue, :wed, :thur, :fri, :sat, :sun]
count = 0
DAYS.each do |day|
if day == :tue .. day == :thur
count += 1
end
@changs
changs / add_show_output_from_server.patch
Created January 10, 2014 15:52
Add to AB the ability to show response from server for every request.
diff --git a/ab.c b/ab.c
index 5a6f2a0..c1c88a5 100644
--- a/ab.c
+++ b/ab.c
@@ -262,6 +262,7 @@ struct data {
/* --------------------- GLOBALS ---------------------------- */
int verbosity = 0; /* no verbosity by default */
+int show_response = 0; /* non-zero to show server response to every request */
int recverrok = 0; /* ok to proceed after socket receive errors */
rvm get head
brew install autoconf automake
rvm uninstall 1.9.3-p327
rvm cleanup sources
rvm install 1.9.3-p327 --patch falcon
rvm reload
bundle
gem pristine --all
@changs
changs / robot.js
Created December 4, 2012 16:39
Dominator
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot;
robot = ev.robot;
@changs
changs / .zshrc
Created June 25, 2012 09:06
ESC-i to put git commit -am "[#pivotal_id_from_clipboard]
function git_commit() {
cmd='git commit -am "[#'
space=' "'
BUFFER=$cmd$(pbpaste)]$space
zle get-line
zle end-of-line
zle backward-char
}
zle -N git_commit
bindkey "^[i" git_commit
before_filter :pre_cors
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
headers['Access-Control-Max-Age'] = "1728000"
end
def pre_cors
@changs
changs / gist:1022659
Created June 13, 2011 11:54
Strace Virtualbox
8032 execve("/usr/lib/virtualbox/VirtualBox", ["/usr/lib/virtualbox/VirtualBox"], [/* 148 vars */]) = 0
8030 brk(0) = 0x1486000
8030 fcntl(0, F_GETFD) = 0
8030 fcntl(1, F_GETFD) = 0
8030 fcntl(2, F_GETFD) = 0
8030 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
8030 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0556ac3000
8030 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
8030 open("/etc/ld.so.cache", O_RDONLY) = 3
8030 fstat(3, {st_mode=S_IFREG|0644, st_size=94091, ...}) = 0