Skip to content

Instantly share code, notes, and snippets.

Avatar

Bartosz "mastier" Woronicz mastier

View GitHub Profile
@Leo-PL
Leo-PL / reset_modem_hard.sh
Created Apr 22, 2020
Simple WAN watchdog for OpenWrt with LTE modem. Add to crontab.
View reset_modem_hard.sh
#!/bin/sh
USB_GPIO=21
DELAY=1
gpio_value="/sys/class/gpio/gpio${USB_GPIO}/value"
echo 0 > ${gpio_value}
sleep ${DELAY}
echo 1 > ${gpio_value}
@Leo-PL
Leo-PL / backup.sh
Created Apr 22, 2020
OpenWrt backup script with git configuration versioning
View backup.sh
#!/bin/bash
DATE=`date -Idate`
USER="root"
HOSTS=("<host1>" ... "<hostn>")
commit_single_host_to_git ()
{
local host=${1}
local backup_filename="backup-${host}-${DATE}.tar.gz"
@Leo-PL
Leo-PL / 96-package_autoinstall
Created Jan 11, 2020
OpenWrt package autoinstallation script after upgrade
View 96-package_autoinstall
#!/bin/sh
# Hotplug trigger script. Put this in /etc/hotplug.d/iface, and ensure this file is backed up over upgrade.
[ "$ACTION" = ifup ] || exit 0
[ "$INTERFACE" = wan ] || exit 0
logger -t package_autoinstall "Checking for package autoinstallation due to $ACTION of $INTERFACE ($DEVICE)"
cd /root
./package_autoinstall.sh
View cleanup-docker.sh
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@oleksiialeksieiev
oleksiialeksieiev / .bash_profile
Last active May 30, 2019
Useful bash profile
View .bash_profile
# SSH agent autostart
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add $HOME/.ssh/id_rsa;
}
@artizirk
artizirk / readme.txt
Created Apr 10, 2015
Huawei E3372h-153
View readme.txt
Working Huawei E3372h-153 SETPORT mappings
replacing A1,A2 with FF turns off need for usb_modeswitch
AT^SETPORT="A1,A2;12,1,16,A1,A2"
^GETPORTMODE: TYPE: WCDMA: huawei,PCUI:0,MDM:1,NDIS:2,CDROM:3,SD:4,
AT^SETPORT="A1,A2;1,12,16,A1,A2"
View machine_learning.md

Python Machine Learning

2013 Sang Han

A collection of notes and useful articles on numerical algorithms.

Definitions

Markov Chains: A special type of stochastic process. The standard