Skip to content

Instantly share code, notes, and snippets.

@ruzickap
ruzickap / openwrt_wireless.sh
Created April 6, 2014 16:55
OpenWrt WiFi configuration tweaks
uci set wireless.radio0.channel=8
uci set wireless.radio0.htmode=HT40-
uci set wireless.radio0.noscan=1
uci set wireless.radio0.bursting=1
uci set wireless.radio0.ff=1
uci set wireless.radio0.compression=1
uci set wireless.radio0.xr=1
uci set wireless.radio0.ar=1
uci set wireless.radio0.txpower=20
@beardicus
beardicus / edgerouter-qos
Last active September 29, 2023 16:41
EdgeRouter Lite QOS Settings
#
# fair-queue based settings for EdgeRouter Lite traffic shaping
#
# download is typically 30 and change. everything can burst to 100%
# of bandwidth, priority rules keep the garbage in check
set traffic-policy shaper download
set traffic-policy shaper download bandwidth 30Mbit
@bfg100k
bfg100k / snapRAID_helper.sh
Last active May 22, 2024 13:49
Bash helper script to help with the automation of routine snapRAID tasks. Add it as a cron job to automate the routine tasks of running sync and scrub. Script will optionally send you email of status and issues encountered during the run.
#!/bin/bash
#######################################################################
# This is a helper script that keeps snapraid parity info in sync with
# your data and optionally verifies the parity info. Here's how it works:
# 1) It first calls diff to figure out if the parity info is out of sync.
# 2) If parity info is out of sync, AND the number of deleted files exceed
# X (configurable), it triggers an alert email and stops. (In case of
# accidental deletions, you have the opportunity to recover them from
# the existing parity info)
# 3) If partiy info is out of sync, AND the number of deleted files exceed X
@yumminhuang
yumminhuang / package_updates_check.py
Created March 18, 2015 20:39
Python script to check apt-get updates
#!/usr/bin/env python
#coding=utf-8
import apt
import apt_pkg
from time import strftime
import os
import subprocess
import sys
@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active July 9, 2024 14:16
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@sling00
sling00 / dfree
Last active October 22, 2023 13:05
disk free for samba that can determine fs type and calculate accordingly.
#!/bin/bash
#Originally by stanislavs from post http://stanislavs.org/reporting-correct-space-usage-for-samba-shared-zfs-volumes/#comment-2443
#Used some updated code from github user umito / Peter on that site to clean up the non zfs code.
if [[ `findmnt -n -o FSTYPE -T "$PWD" | grep -c zfs` > 0 ]]
then
# echo "DEBUG: this is zfs"
USED=$((`zfs get -o value -Hp used $PWD` / 1024)) > /dev/null
AVAIL=$((`zfs get -o value -Hp available $PWD` / 1024)) > /dev/null
TOTAL=$(($USED+$AVAIL)) > /dev/null
@Zerogiven
Zerogiven / debian-bash-helper-functions.sh
Last active October 2, 2016 13:07
Functions which i need in my bash scripts but could also be nice for other ones
#!/bin/bash
# CSoellinger
######################################################
# Function Vars
APT_INSTALL="apt-get install -yqqq"
APT_UPDATE="apt-get update -yqqq"
NPM_INSTALL="npm --loglevel=silent install -g"
TEXT_DONE="DONE"
TEXT_WAITING_DOTS="... "
@stevejenkins
stevejenkins / EdgeMax-Google-TV.sh
Last active April 24, 2019 14:50
Additional script for Google Fiber TV customers to run on their EdgeRouter, after running the initial EdgeMax-Google.sh script, to enable TV service.
# Google Fiber TV Service Additional Script
# Based on Atlantisman's TV script
# http://blog.nexusshield.com/google-fiber-ubiquitis-edgerouter/
# Edited by Steve Jenkins to work with his version of the script
#______________________TV Service Config _____________________
#Setup IGMP Proxy
configure
edit protocols igmp-proxy
set interface eth0.2 role upstream
set interface eth2 role downstream
@catchdave
catchdave / install_pia_vpn.sh
Last active December 28, 2022 03:21
CLI script to install Private Internet Access VPN on a ubuntu server
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
set -o nounset
set -o errexit
error_exit()
@wassupdoc
wassupdoc / zone_instructions
Last active July 10, 2024 03:41
Zone settings for edgerouter
#based on http://www.forshee.me/2016/03/02/ubiquiti-edgerouter-lite-setup-part-2-firewall-setup.html
configure
edit firewall name allow-est-drop-inv
set default-action drop
set enable-default-log
set rule 1 action accept
set rule 1 state established enable
set rule 1 state related enable
set rule 2 action drop