Skip to content

Instantly share code, notes, and snippets.

View trick77's full-sized avatar

trick77

  • Schwiiz
View GitHub Profile
#!/bin/sh
#
# tcpping: test response times using TCP SYN packets
# URL: http://www.vdberg.org/~richard/tcpping.html
#
# uses tcptraceroute from http://michael.toren.net/code/tcptraceroute/
#
# (c) 2002-2005 Richard van den Berg <richard@vdberg.org> under the GPL
# http://www.gnu.org/copyleft/gpl.html
#
@trick77
trick77 / create-windows-vm.sh
Last active December 5, 2023 05:27
Shell script to create a Windows server 2019 KVM using virt-install and LVM
#!/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
#!/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
#!/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 June 3, 2018 12:20
Working 20-updates for motd
#!/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 / naswake.sh
Last active October 16, 2015 14:31
Shell script which checks if network is up and wakes a WOL device using wakeonlan
#!/bin/sh
. /etc/rc.common
CheckForNetwork
while [ "${NETWORKUP}" != "-YES-" ]
do
sleep 1
NETWORKUP=
CheckForNetwork
done
/usr/local/bin/wakeonlan 00:08:9B:C5:BD:21 #<-- Enter NAS MAC address here
@trick77
trick77 / virt-backup.pl
Last active April 3, 2019 11:31
virt-backup.pl: fixed paths so live images will work again in Ubuntu 14.04
#!/usr/bin/perl -w
#
# 1. Install required dependencies:
# sudo apt-get install -y libxml-simple-perl pv libsys-virt-perl
# 2. Run it like this (assuming the LVM disk size is 20G):
# /virt-backup.pl --vm mykvm --state --snapsize=20G --backupdir /tmp --debug --compress
#
# AUTHOR
# Daniel Berteaud <daniel@firewall-services.com>
#
@trick77
trick77 / gov.sh
Last active August 18, 2020 09:49
Bash shell script to set the CPU governor to any supported scaling mode (performance, ondemand...)
#!/bin/bash
available_governors=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors \
| head -1 | sed -e 's/ \([a-zA-Z0-9]\)/|\1/g' -e 's/ $//')
if [ $# -ne 1 ]
then
echo "Usage: $0 [$available_governors]"
fi
function current_cpu_governor ()
{