Skip to content

Instantly share code, notes, and snippets.

@kstevens715
kstevens715 / throttle.sh
Created January 22, 2013 20:51
Throttle your loopback interface in Linux to test low bandwith. I was testing an AJAX file upload progress bar and found this helpful.
# Throttle LO interface
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 20kbps ceil 20kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 1000ms
# Go back to the way things were.
sudo tc qdisc del dev lo root
@jonathanlurie
jonathanlurie / jsont.js
Last active August 16, 2023 08:33
Serialize/deserialize json and conserve typed arrays
/*
Author: Jonathan Lurie - http://me.jonathanlurie.fr
License: MIT
The point of this little gist is to fix the issue of losing
typed arrays when calling the default JSON serilization.
The default mode has for effect to convert typed arrays into
object like that: {0: 0.1, 1: 0.2, 2: 0.3} what used to be
Float32Array([0.1, 0.2, 0.3]) and once it takes the shape of an
object, there is no way to get it back in an automated way!
@e-desouza
e-desouza / vlc-osx-delete.lua
Created August 23, 2020 04:12
Delete current file on disk and playlist in VLC (OSX only)
--[[
Copyright 2020 wizard
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.