Skip to content

Instantly share code, notes, and snippets.

View jandahl's full-sized avatar

Jan Gronemann jandahl

  • Spacepope
  • Denmark
View GitHub Profile
@jandahl
jandahl / GNUscreen-OSX-slowpaste.md
Last active April 17, 2023 13:35
Using GNU screen as a slow pasting virtual serial console terminal

Using GNU screen as a slow pasting virtual serial console terminal

A quick primer

You will need

  1. A Macintosh computer
  2. A USB-to-serial adapter
  3. A file with a config you want to paste sloooowly
  4. A few minutes

1. Make a sensible ~/.screenrc file

# Made for bash, assumes you have a working rancid/clogin set up
#
# Point the below to your local copy of the list
OUIList=~/oui.txt
if [ ! -c $OUIList ]
then ## Check if $OUIList exists, if not, download and save it
# touch $OUIList
echo "Fetching the OUI list. This might take a little while. Like, 2 minutes."
#!/usr/bin/env bash
function aboutMe {
myName=$(basename "$0")
echo -e "\nAlias extruder for RTR hostnames"
echo -e "Usage:\n\t$myName countryNumber"
echo -e "Example:\n\t$myName 49\n"
}
function doStuff () {
for n in {1..254}

Example of input and output for "template usage help" output

Page before running

Hello {{{Name}}},
Thanks for {{{Reason|being you}}}

Page after running

<noinclude>
Usage:

\

#!/usr/bin/env bash
function basicSetup {
date=$(date +%Y-%m-%d-kl-%H-%m)
snmpCommunityString="snmpstring"
ipTftpServer="10.20.30.40"
targetHostName=$(snmpwalk -v 2c -c $snmpCommunityString $targetHost iso.3.6.1.2.1.1.5.0 | awk -F"\"" '{print $2}' | sed 's_.net.dsv.com__')
outputFileName=/snmp-pushed-configs/$date-$targetHostName-$targetHost.txt
neutralOutputFileName=/snmp-pushed-configs/$targetHostName-$targetHost.txt
#!/usr/bin/env bash
# Minecraft Overviewer stuff circulator
# v2
# Makes some assumptions, here be dragons
# VARIABLES
serverBaseDirectory=/opt/msm/servers/
worldName=Popeworld
workingDirectory=~/overviewer
@jandahl
jandahl / TCAMcheck.sh
Last active December 18, 2015 17:10
clogin script to crawl the routers in the array given on line 3. Assumes working .cloginrc. Has progress bar.
#!/usr/bin/env bash
function aboutMe {
echo -e "\n\tTCAMcheck.sh v. 2013-06-20"
echo -e "\tPull out L3 TCAM load from 760x routers and show more than $warningThreshold% load"
echo -e "\n\tExample:\n\n\t\t`basename $0` \033[1;31mdr1.hors dr6.hors router3 router4\033[1;0m\n"
echo -e "\n\tWhen run from the command line, it will update your screen/byobu title line and show you the results in less"
echo -e "\n\tIt even has a progress bar!"
echo -e "\n\tIt *should* play nice with pipes and crontab, but YMMV"
echo e- "\n\tAlso, it doesn't tell you when it can't reach a router."
@jandahl
jandahl / ss
Created May 8, 2013 12:38
Update screen/byobu window title based on hostname you want to ssh to
#!/usr/bin/env bash
# Remember to check your $TERM and fix the conditional below
if [ $TERM == "screen-bce" ] ; then
trap 'echo -n -e "\033k${HOSTNAME}\033\\"' 0 1 2 15
echo -n -e "\033k$1\033\\"
fi
/usr/bin/ssh $*
@jandahl
jandahl / pingu.sh
Last active October 12, 2021 10:16
Ping med logfil
#!/usr/bin/env bash
function aboutMe() {
printf "\n\t%s, ver %s" "${scriptName}" "${scriptVersion}"
printf "\nPing a given host with a certain frequency - 5 seconds default - and save in a time stamped file"
printf "\nUsage:\n\n\t%s%s ADDRESS %s" "${scriptFile}" "${Emphasize}" "${ColorOff}"
printf "\n\n\tExample:"
printf "\n\t\t%s%s www.example.org 10%s" "${scriptFile}" "${Emphasize}" "${ColorOff}"
printf "\n\n\tSet timer to 10 seconds:"
printf "\n\t\t%s%s -t 10 %s www.example.org\n\n" "${scriptFile}" "${Emphasize}" "${ColorOff}"
@jandahl
jandahl / term.log
Created December 12, 2012 12:41
yeoman phantomjs confess phase
$ ps axu 42991
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
jandahl 42991 32.0 0.8 780944 63372 s002 S+ 10:21AM 59:27.44 /usr/local/bin/phantomjs /usr/local/lib/node_modules/yeoman/lib/support/confess.js http://localhost:3501 appcache /usr/local/lib/node_modules/yeoman/lib/support/conf