Skip to content

Instantly share code, notes, and snippets.

View mastier's full-sized avatar
🤯
exploding ideas

Bartosz "mastier" Woronicz mastier

🤯
exploding ideas
View GitHub Profile
#!/bin/bash
set -euoE pipefail
# Redfish commands related to Virtual Media.
# Redfish doc reference: https://www.supermicro.com/manuals/other/RedfishRefGuide.pdf
export BMC_ADDRESS=''
export ISO_IMAGE=http://192.168.117.9:8080/ocp4-rwn-1-small.iso
export username_password='Administrator:superuser'
@Leo-PL
Leo-PL / reset_modem_hard.sh
Created April 22, 2020 22:34
Simple WAN watchdog for OpenWrt with LTE modem. Add to crontab.
#!/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 April 22, 2020 22:29
OpenWrt backup script with git configuration versioning
#!/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 January 11, 2020 12:43
OpenWrt package autoinstallation script after upgrade
#!/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
@kaxing
kaxing / lxc-loop-device.note.md
Last active October 24, 2022 01:27
Mount Image file or loop device inside lxc container
#!/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 13:25
Useful 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 April 10, 2015 19:34
Huawei E3372h-153
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"