Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

trick77

🎯
Focusing
View GitHub Profile
View snmpd-silencer.sh
#!/bin/sh
sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service && systemctl daemon-reload && service snmpd restart
View bcnode.sh
#! /usr/bin/env bash
lbtcbh () {
height=$(curl --silent https://blockchain.info/latestblock | jq .height | tr -d "\\n\"")
height=$((height-1))
hash=$(curl --silent https://blockchain.info/block-height/$height?format=json | jq .blocks[0].hash | tr -d "\\n\"")
echo -n "$hash"
}
export BTC_BOOT_BLOCK=$(lbtcbh)
echo "Using $BTC_BOOT_BLOCK as previous BTC block hash"
@trick77
trick77 / create-windows-vm.sh
Last active Dec 22, 2019
Shell script to create a Windows server 2019 KVM using virt-install and LVM
View create-windows-vm.sh
#!/bin/sh
#
# Creates a Windows server KVM using LVM.
# Use ssh forwarding to access the VNC display to complete the Windows installation, like ssh example.host -L 56681:127.0.0.1:56681
# Once connected with VNC, browse for the viostor driver
#
# In this example, both network bridges on the host will be available in the Windows VM.
#
NAME=desktop
RAM=4096
View result.log
This file has been truncated, but you can view the full file.
[nodemon] 1.18.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./app.js`
count=1, timestamp=1/3/2019, 6:17:12 AM (EST), height=1851222, txCount=0, txsListSize=0, twsListSize=0, txFeeBase=0, txDistanceSumLimit=0, miner=0x069caa5b07f52dfad4b0a3bbee1bf956d65f908a
count=2, timestamp=1/3/2019, 6:17:25 AM (EST), height=1851223, txCount=0, txsListSize=0, twsListSize=0, txFeeBase=0, txDistanceSumLimit=0, miner=0x88f0e154482894387a3f8ba555da07b53382be58
count=3, timestamp=1/3/2019, 6:17:43 AM (EST), height=1851224, txCount=0, txsListSize=0, twsListSize=0, txFeeBase=0, txDistanceSumLimit=0, miner=0x34d0c4b7f5f72690b441f6f6a50b6f81401cbdce
count=4, timestamp=1/3/2019, 6:17:45 AM (EST), height=1851225, txCount=0, txsListSize=0, twsListSize=0, txFeeBase=0, txDistanceSumLimit=0, miner=0x1bd4f5ebe0b44605204e8587cfed49086fbc07c6
View hostapd.conf
interface=wlan0
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=MyWIFIid
country_code=CH
hw_mode=a
View modeswitch.sh
#!/bin/sh
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.ip_default_ttl=65
/usr/sbin/usb_modeswitch -v12d1 -p1f01 -J
sleep 5
/sbin/dhclient -1 -v -pf /run/dhclient.eth3.pid -lf /var/lib/dhcp/dhclient.eth3.leases -I -df /var/lib/dhcp/dhclient6.eth3.leases eth3
/sbin/iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE
/bin/systemctl restart hostapd
exit 0
View 10-sysinfo
#!/bin/bash
#
# 10-sysinfo - generate the system information
# Copyright (c) 2013 Nick Charlton
#
# Authors: Nick Charlton <hello@nickcharlton.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
View 00-header
#!/bin/sh
#
# 00-header - create the header of the MOTD
# Copyright (c) 2013 Nick Charlton
# Copyright (c) 2009-2010 Canonical Ltd.
#
# Authors: Nick Charlton <hello@nickcharlton.net>
# Dustin Kirkland <kirkland@canonical.com>
#
# This program is free software; you can redistribute it and/or modify
@trick77
trick77 / 20-updates
Created Jun 3, 2018
Working 20-updates for motd
View 20-updates
#!/usr/bin/python3
#
# 20-updates - create the system updates section of the MOTD
# Copyright (c) 2013 Nick Charlton
#
# Authors: Nick Charlton <hello@nickcharlton.net>
# Based upon prior work by Dustin Kirkland and Michael Vogt.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@trick77
trick77 / rigcheck.sh
Last active Apr 5, 2019
Checks for crashed ethOS 1.2.9 mining processes
View rigcheck.sh
#!/bin/bash
#
# Minimalistic auto-reboot script for ethOS 1.2.9 - 1.3.1
# https://trick77.com/auto-restart-crashed-mining-processes-ethos
#
# This script will automatically reboot the mining rig depending on the reported
# mining status in ethOS.
# - The script should be triggered every 15 minutes from a cron job. Do not run it in shorter intervals.
# - May or may not work with other ethOS versions than indicated above.
#
You can’t perform that action at this time.