View stopwatch.py
# We create a simple python context manager to log measure time of our code. | |
from timeit import default_timer as timer | |
class stopwatch(object): | |
def __init__(self, description, log_fn=None): | |
self.description = description | |
self.log_fn = log_fn | |
def __enter__(self): | |
self.start = timer() | |
return self |
View openwrt-lede-on-pogoplug-mobile.sh
# --------------------------------------------------------------------------------- | |
# Device - PogoPlug Mobile - Install OpenWrt on internal flash (128mb) and keep allowing boot to SD or USB | |
# --------------------------------------------------------------------------------- | |
http://blog.qnology.com/2015/02/openwrt-on-pogoplug-mobile.html | |
# Corrected URLs, because download.qnology.com is down: | |
http://ssl.pepas.com/pogo/mirrored/download.qnology.com/pogoplug/v4/ | |
cd /tmp | |
#wget http://ssl.pepas.com/pogo/mirrored/download.qnology.com/pogoplug/v4/fw_printenv |
View pure_debian_on_iomega_ez.sh
# Relevant info about this: | |
https://forum.lede-project.org/t/lenovo-iomega-ez-media-backup-center/5031/ # "Lenovo Iomega EZ Media & Backup Center" | |
https://forum.doozan.com/read.php?2,35331,35434#msg-35434 # "Lenovo iomega EZ support" but read entire thread if it is possible | |
https://forum.doozan.com/read.php?2,15887 # "Debian on Iomega EZ Media & Backup Center" this is another thread about | |
https://forum.doozan.com/read.php?2,12096 # "Linux Kernel 4.14.1 Kirkwood package and Debian rootfs" Kernel and rootfs, thanks to this it is possible to run Debian | |
# Newer kernel guide: | |
https://gist.github.com/koczaj/a20ed52c969a8d0612986ca576067876 | |
# Using a Debian box (it could be a VM) with the harddrive connected (it could be a minimal net-install Debian) | |
See ip with: | |
ip addr show |
View openwrt-lede-on-pc-vm.sh
# ---------------------------------------------------------------------- | |
# Instruction to have OpenWRT or LEDE on a X86 PC or Virtual Machine: | |
# ---------------------------------------------------------------------- | |
# boot using DamnSmallLinux or similar: | |
sudo /etc/init.d/ssh start | |
# see IP to connect using ssh | |
ifconfig | |
# set a password for root | |
su |
View remove_dups_tmbackup.sh
#!/usr/bin/env bash | |
# thisfile: remove_dups_tmbackup.sh | |
# save the current path | |
CURRENT_DIR=$(pwd) | |
# receive backup destinarion directory as argument | |
DEST_DIR="$1" | |
# search for last previous destination directory name |
View OpenWRT-LEDE-uci-defauls-TP-LINK-factory-SSID-KEY.sh
# This is to use on image building process to make TP-Link have autoconfigured with factory SSID and KEY | |
mkdir ./files/etc/uci-defaults/ | |
cat <<'__EOF__' > ./files/etc/uci-defaults/99_default-no-eth.sh | |
#!/bin/sh | |
[ "$(uci -q get system.@system[0].init)" = "" ] && exit 0 | |
[ -e /etc/init ] && exit 0 | |
touch /etc/init | |
uci batch <<EOC |
View image-builder-openwrt-lede.sh
# ------------------------------------------------------------------------ | |
# Image-Builder Procedure for OpenWRT - LEDE (In this case using Debian x64 NetInstall virtual machine) | |
# ------------------------------------------------------------------------ | |
su | |
apt-get update # Optional, make and upgrade too in case it has too many old pakackes. | |
apt-get install make aria2 screen ncftp -y | |
screen - | |
cd ~ |
View openwrt-lede-on-wd-mbl.sh
# Instructions to Install OpenWRT or LEDE on WD MBL Western Digital MyBookLive (Tested on Single, but it should work on Duo too) | |
# Recommended to use a Linux / Debian box with wget, dd, gunzip, lsblk | |
# Using a Debian box (it could be a VM) with the harddrive connected (it could be a minimal net-install Debian) | |
See ip with: | |
ip addr show | |
# connect remotely using: | |
user@outside:~/# ssh user@10.211.55.6 | |
# We elevate permissions or even better install and config sudo | |
user@debian8vm:~/# su |
View equal-bonding-link.sh
# Equal Cost Routing (OpenWrt - LEDE) | |
# Attention: This was not tested yet. | |
# Can be used with, for example, two Internet access points. In this case accessible via the same interface. | |
# Install software package iproute2 | |
opkg update | |
opkg install ip | |
# Set up routing at boot, idk if could be elsewhere in better place |
View wireless-link-bonding.sh
# Linux Interface Bonding on Wireless Link (OpenWrt / LEDE) | |
# Attention: This was not tested yet. | |
# Important: WLAN Interfaces must be AP - STA, it does not work in ad-hoc - infraestructure mode. | |
# This "Adds" two interfaces in to one. In this sample we are using Wireless Interfaces | |
# Should be equally configured on both ends, even the hash function for the distribution of data packets | |
# Intallation of required packages: |
NewerOlder