Skip to content

Instantly share code, notes, and snippets.

View sadasant's full-sized avatar
👁️

Daniel Rodríguez sadasant

👁️
View GitHub Profile
@sadasant
sadasant / LICENSE
Last active August 29, 2015 13:56 — forked from ghostbar/LICENSE
Copyright © 2014 Jose Luis Rivas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
MotionNotify 569 286
KeyStrPress Shift_L
KeyStrPress semicolon
KeyStrRelease semicolon
KeyStrRelease Shift_L
KeyStrPress Shift_L
KeyStrPress 1
KeyStrRelease 1
KeyStrPress 3
KeyStrRelease 3
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }
@sadasant
sadasant / rb.rb
Created May 21, 2014 21:27 — forked from scalone/rb.rb
module T
def self.display
puts "display 1"
end
end
T.display
def T.display
puts "display 2"
@sadasant
sadasant / file_db.rb
Last active August 29, 2015 14:02 — forked from scalone/file_db.rb
class FileDb < Hash
attr_accessor :path
def initialize
super
end
def self.open(path)
f = self.new
@sadasant
sadasant / etcd.js
Created July 16, 2014 21:03
Simple etcd client with tests
var request = require("request");
var qstr = require("querystring").stringify;
var Args = require("args-js");
var utils = require("../utils");
var etcd = module.exports = {};
var watchers = etcd.watchers = {};
var timeout_code = "ESOCKETTIMEDOUT";
// From: https://stackoverflow.com/a/14041378
function toUserTimeZone(utc_date, offset){
if (utc_date.slice(-3) !== "UTC") {
utc_date += " UTC";
}
var local_date = new Date(utc_date);
var local_offset = local_date.getTimezoneOffset() * 60000;
var utc_time = local_date.getTime() + local_offset;
return new Date(utc_time + (3600000 * offset));
@sadasant
sadasant / mrbc_fail.rb
Last active August 29, 2015 14:07 — forked from scalone/mrbc_fail.rb
# To compile `mrbc -o mrbc_fail.mrb mrbc_fail.rb`
class_decation_error T
def self.a
puts "aa"
end
end
@sadasant
sadasant / read.js
Last active August 29, 2015 14:09
Reading fast bookmarklet
// Bookmark url (remember to update the https link inside it for your fork):
// javascript:(function(){var d=document,s=d.createElement('script');s.src='https://cdn.rawgit.com/sadasant/1d51bd8d26b5fd94f9f3/raw/read.js';d.body.appendChild(s);}())
if (window.READING) {
alert("READ is already available :)");
} else {
(function() {
var READING = window.READING = {};
READING.delay = 100;
READING.extra = 100;
READING.top = 100;