Skip to content

Instantly share code, notes, and snippets.

View amgedr's full-sized avatar

Amged Rustom amgedr

View GitHub Profile
@drewmoseley
drewmoseley / yocto-mender-rpi3.sh
Last active June 8, 2022 13:44
Script to build Yocto+Mender for Raspberry Pi 3
#!/bin/bash
#
if [ "$(/bin/ls -1A | wc -l)" -ne "0" ]; then
echo Please run this from an empty directory.
exit 1
fi
BASE=$(pwd -P)
@trongthanh
trongthanh / gist:1196596
Created September 6, 2011 04:37
Emulate slow Internet connection speed on localhost with netem (Ubuntu)
#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
@dryan
dryan / remove_www_middleware.py
Created January 30, 2010 22:54
Django middleware for removing www.
class RemoveWWW(object):
def process_request( self, request ):
try:
if request.META['HTTP_HOST'].lower().find('www.') == 0:
from django.http import HttpResponsePermanentRedirect
return HttpResponsePermanentRedirect( request.build_absolute_uri().replace('//www.', ‘/') )
except:
pass
return None