Skip to content

Instantly share code, notes, and snippets.

View Strykar's full-sized avatar
💭
What is Bash?

Avinash H. Duduskar Strykar

💭
What is Bash?
  • India
View GitHub Profile
#!/bin/bash
#METHOD=netperf
METHOD=nuttcp
HOST=ref1
HOSTIP="192.168.0.2"
TARGETUSER=root
TARGET=target
#!/bin/sh
# Two examples for batch conversion of RRD to XML (done on the host the RRD were created on)
# Convert from XML back to RRD on the new host/arch
for f in *.rrd; do rrdtool dump ${f} > ${f}.xml; done
for f in *.xml; do rrdtool restore ${f} `echo ${f} | cut -f1 -d .`.rrd; done
find /tmp/data -type f -iname '*.rrd' -print0|while IFS= read -r -d '' f; do rrdtool dump ${f} > ${f}.xml; done
find /tmp/data -type f -iname '*.xml' -print0|while IFS= read -r -d '' f; do rrdtool restore ${f} `echo ${f} | cut -f1 -d .`.rrd -f; done
#See busy $10 Linode vm vs this $5 spare DO - https://gist.github.com/fwaggle/0ca82bc8454813550fc21b0200e58d9a
% sudo diskinfo -ctv /dev/gpt/rootfs
/dev/gpt/rootfs
512 # sectorsize
21474836480 # mediasize in bytes (20G)
41943040 # mediasize in sectors
0 # stripesize
1073759744 # stripeoffset
41610 # Cylinders according to firmware.
16 # Heads according to firmware.
# ipsec.conf - strongSwan IPsec configuration file
config setup
# uniqueids=yes
# charondebug="cfg 2, lib 1, dmn 1, ike 5, net 1, knl 1"
conn %default
keyexchange=ikev2
dpdaction=clear
#!/bin/sh
# Check disk usage periodically via cron and free space up if $full - Stry
# send email to $admin
#ADMIN="admin@hackerzlair.org"
# set alert level in percentage
ALERT=95
# List directories we can safely smoke
#!/bin/bash
# Wrapper for cron to check and start TF2 server from $SCRIPT if need be
# cron is setup as:
# @reboot /home/tf2server/tf2d.sh start &> /dev/null
# */5 * * * * /home/tf2server/crontf2d.sh &> /dev/null
#
if ! /usr/bin/pgrep srcds ; then /home/tf2server/tf2d.sh start; fi
# Script to delete files older than one hour - run from cron
# Wednesday, November 07, 2007
#!/bin/bash
find /path/to/dir -cmin +60 -type f -maxdepth 1 -exec rm {} \;
#1
cacls d:\cygwin /T /e /g Administrators:f
rmdir /S d:\cygwin
#2
takeown /f "d:\cygwin" /r /d Y
icacls "d:\cygwin" /T /Q /C /reset
## This is an 'Include' style gapps-config in 3 sections that:
## 1. Lists the stock apps to remove. Yes, just list them in an Include style config too.
## 2. Forces install of the stock apps listed. The + prevents these being uninstalled by accident, like listing them in 1 above.
## 3. Installs only the Google Apps we list. https://github.com/opengapps/opengapps/wiki/Advanced-Features-and-Options
Include
## Skip installing swype keyboard libs, we use the stock keyboard which does not support it
skipswypelibs
#!/bin/sh
# Cron script to telnet to ircd and log output of commands so we can run stats
# TODO: Clean this up so it just updates /var/www/htdocs/member/Strykar/images/ircdstats.sh_irc.hackerzlair.org.rrd
MYHOST=localhost
# This is inefficient and needs to change.
# Currently awk-drops first 3 columns and prints server date:time:tz, uptime and connection count
# geckoo www.hackerzlair.org :Tuesday December 18 2012 -- 05:08:54 -06:00
# geckoo :Server Up 62 days, 22:28:41
# geckoo :Highest connection count: 11 (9 clients) (381 connections received)