Skip to content

Instantly share code, notes, and snippets.

View sadasant's full-sized avatar
👁️

Daniel Rodríguez sadasant

👁️
View GitHub Profile
#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
@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
@sadasant
sadasant / command.sh
Created December 17, 2013 02:57 — forked from xxuejie/command.sh
# Suppose the currenct directory is ~/develop
$ git clone https://github.com/redis/hiredis
$ cd hiredis
# Set emscripten compiling target
$ export EMCC_LLVM_TARGET=i386-pc-linux-gnu
# Locale the installation path of webruby, for example, on my mac this is:
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/
@sadasant
sadasant / tools.js
Last active December 29, 2015 02:39
JavaScript Tools
// Change a function to log arguments and return
function log_args_return(f){
var s=f.toString(),
n=f.name,
_n="_"+n;
return "function "+n+"(){"+
s.replace(n,_n)+
";console.log('"+n+" args', Array.prototype.slice.call(arguments));"+
"var r="+_n+".apply(null, arguments);"+
"console.log('"+n+" return', r);return r}"
app.directive('ngFocus', ['$parse', function($parse) {
return function(scope, element, attr) {
var fn = $parse(attr['ngFocus']);
element.bind('focus', function(event) {
scope.$apply(function() {
fn(scope, {$event:event});
});
});
}
}]);

This is a simple demo of how to create and use a Response Interceptor in AngularJS. In this case we are using the interceptor to convert the objects created from a JSON data load into typed instances of a custom "class".

20:23 ::: sadasant [~sadasant@190.142.44.181] has joined #OPENVE
20:23 [Users #OpenVE]
20:23 [ NeftaliYagua] [ pankas87] [ sadasant] [ VEbot]
20:23 ::: Irssi: #OpenVE: Total of 4 nicks [0 ops, 0 halfops, 0 voices, 4 normal]
20:23 !zelazny.freenode.net [freenode-info] please register your nickname...don't forget to auto-identify!
http://freenode.net/faq.shtml#nicksetup
20:23 ::: Channel #OPENVE created Tue Sep 18 22:53:18 2012
20:23 VEbot >> sadasant: ¡Bienvenido a OpenVE! :)
20:23 ::: Irssi: Join to #OpenVE was synced in 9 secs
20:23 pankas87 >> ola gentes

Getting command line tools on your Chromebook

If you want have some fun in the terminal with your new ARM Chromebook here's how to get a simple Arch Linux ARM chroot up and running. It assumes you already have your Chromebook in dev mode, if not google it before you continue.

This method requires no partitioning or other messing with your system, it just uses the fact that the /usr/local space is writable and persisted between upgrades.

First of, download http://archlinuxarm.org/os/ArchLinuxARM-imx6-latest.tar.gz

Open crosh with Ctrl+Alt+T

Getting command line tools on your Chromebook

If you want have some fun in the terminal with your new ARM Chromebook here's how to get a simple Arch Linux ARM chroot up and running. It assumes you already have your Chromebook in dev mode, if not google it before you continue.

This method requires no partitioning or other messing with your system, it just uses the fact that the /usr/local space is writable and persisted between upgrades.

First of, download http://archlinuxarm.org/os/ArchLinuxARM-imx6-latest.tar.gz

Open crosh with Ctrl+Alt+T