Skip to content

Instantly share code, notes, and snippets.

View indiejoseph's full-sized avatar
🏠
Working from home

Joseph Cheng indiejoseph

🏠
Working from home
View GitHub Profile
@unverbraucht
unverbraucht / gist:118117ab66ac142f4eda
Last active January 24, 2023 18:16
Script for OpenWRT that adds delay, bandwidth limiting and packet loss to a Wi-Fi router connection. See http://kevin-read.com/post/86601925386/simulating-a-slow-network-connection-when-testing-on for details
#!/bin/sh
# The bandwidth to simulate, here about 56kilobit per second. This is layer 2 bandwidth, so TCP/UDP and IP overhead will apply
BW="56kbps"
# _Half_ the latency that we aim for. Since this applies to both the WAN port and Wi-Fi, the delay is applied twice, so this actually puts it at around 120+ms
LATENCY="60ms"
# Chance of packet loss. Also applied to both interfaces, so it is 1%.
LOSS="0.5%"
# The device name of your wifi device.
WIFI="wlan0"
@ruzickap
ruzickap / openwrt_transmission.sh
Last active May 8, 2024 16:04
OpenWrt Transmission
opkg install transmission-remote transmission-web
mkdir -p /data/torrents/torrents-completed /data/torrents/torrents-incomplete /data/torrents/torrents /data/torrents/config
uci set transmission.@transmission[-1].enabled=1
uci set transmission.@transmission[-1].config_dir=/data/torrents/config
uci set transmission.@transmission[-1].download_dir=/data/torrents/torrents-completed
uci set transmission.@transmission[-1].incomplete_dir_enabled=true
uci set transmission.@transmission[-1].incomplete_dir=/data/torrents/torrents-incomplete
uci set transmission.@transmission[-1].blocklist_enabled=1
#!/bin/bash
# Downsamples all retina [email protected] images.
for f in $(find . -name '*@2x.png'); do
echo "Converting $f..."
convert "$f" -resize '50%' "$(dirname $f)/$(basename -s '@2x.png' $f).png"
done
@marionebl
marionebl / OpenWRT nodejs Makefile
Created February 1, 2014 13:11
OpenWRT nodejs Makefile 0.10.25
include $(TOPDIR)/rules.mk
PKG_NAME:=nodejs
PKG_VERSION:=0.10.25
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/node-v$(PKG_VERSION)
PKG_SOURCE:=node-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://nodejs.org/dist/v$(PKG_VERSION)/
PKG_MD5SUM:=153bdbf77b4473df2600b8ce123ef331
@c1b3rh4ck
c1b3rh4ck / op.sh
Created January 19, 2014 15:07
opkg quick installer
#!/bin/bash
#feedback:[email protected]
#install the luci interface web using an offline method
#hackaton 9 de ag you will need to upload this to 192.168.1.1 /tmp!
pkgs=(blua lua libuci-lua libubus-lua uhttpd luci-lib-ipkg luci-i18n-english luci-sgi-cgi luci-lib-core luci-lib-nixio luci-lib-sys luci-lib-web luci-proto-core luci-theme-base luci-theme-openwrt luci-mod-admin-core luci-mod-admin-full)
for pkg in "${pkgs[*]}
do
opkg install /tmp/luci-offline-packages/$pkg*.ipk
@mohamed-ali
mohamed-ali / dataMiner.js
Last active July 25, 2018 18:34
dataMiner: simple, compact, reusable client side data mining
/*
* Copyright (c), Mohamed Ali Jamaoui, All rights reserved
* released under the MIT license
*/
var dm = {};
dm.dataMiner = function module(){
@jbgutierrez
jbgutierrez / setup-continuous-deployment-ubuntu-12.10-x86_64.sh
Last active December 27, 2015 07:59
Self-contained bash script to setup continuous deployment for nodejs apps built on top of ubuntu, git and foreman
DEPLOYER='deployer'
DEPLOYER_HOME="/home/$DEPLOYER"
PROJECT_NAME='node-js-sample'
PROJECT_REPO='https://github.com/heroku/node-js-sample.git'
# Provisining an ubuntu server
apt-get -y update
apt-get -y upgrade
apt-get -y install software-properties-common
add-apt-repository ppa:chris-lea/node.js
@imbcmdth
imbcmdth / fast_math.js
Last active June 26, 2021 05:54
Fast Approximate Functions for JavaScript based on https://code.google.com/p/fastapprox/
var Approx = {
fastlog2: (function () {
var a = new ArrayBuffer(4),
i = new Int32Array(a),
f = new Float32Array(a);
return function fasterLog2 (number) {
f[0] = number;
var t = i[0] * 1.1920928955078125e-7;
return t - 126.94269504;
# coding=UTF-8
from __future__ import division
import nltk
import re
import requests
# Add your freebase key here
# If you don't have one, register at https://code.google.com/apis/console
FREEBASE_KEY = ""
@rolph-recto
rolph-recto / contractions.py
Last active January 14, 2016 18:06
Featureset builder for tweets Used for classification and other machine learning tasks
# contractions.py
# list from: http://en.wikipedia.org/wiki/Wikipedia:List_of_English_contractions
contractions = [
("aren't", "are not"),
("can't", "cannot"),
("can't've", "cannot have"),
("'cause", "because"),
("could've", "could have"),
("couldn't", "could not"),
("couldn't've", "could not have"),