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

@jandahl
jandahl / section.sh
Last active November 5, 2021 11:45
bash pipe to section
function section() {
sed -n "/${*}/,/^$/p"
}
@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}"
#!/usr/bin/env bash
function aboutMe() {
printf "\n\t%s, ver %s" "${scriptName}" "${scriptVersion}"
printf "\n\tTries to acces the supplied IP or FQDN via several methods."
printf "\n\tDoesn't care about IPv6."
printf "\n\n\tExample:"
printf "\n\t\t%s %s example.com%s" "${scriptFile}" "${Emphasize}" "${ColorOff}"
printf "\n\t\t%s %s example.com example.org%s" "${scriptFile}" "${Emphasize}" "${ColorOff}"
printf "\n\n\tAlso has a built-in retry timer, using -r! (Note: only way to get out is killing the terminal)"
javascript: (function(n, t) {
t['true'] = n;
var i = function(n, t, i) {
var r = n.style;
r.webkitTransition = r.transition = i + 's';
r.webkitTransitionTimingFunction = r.TransitionTimingFunction = 'ease-in-out';
r.webkitTransform = r.Transform = 'translate3d(0, ' + -t + 'px, 0)'
};
var r = function() {
var n = [].slice.call(arguments);
@jandahl
jandahl / findpi.py
Last active November 10, 2016 08:57
Search for rpis based on name, ssh to first hit; assumes 'eth' is the var that controls which interface to check arp of
#!/usr/bin/env python3
# imports
import netifaces
import os
import subprocess
def main():
eth = 'en9'

Keybase proof

I hereby claim:

  • I am jandahl on github.
  • I am jgronemann (https://keybase.io/jgronemann) on keybase.
  • I have a public key ASBeZuaC6PWQ_TioUFpaU8XUryEC4NXnDoxt4bqJVgplWAo

To claim this, I am signing this object:

@jandahl
jandahl / updowntracker.sh
Last active August 26, 2016 15:47
Uptime-and-downtime-logger
#!/usr/bin/env bash
scriptFile=$(basename "${0}")
scriptName="Uptime-and-downtime-logger"
scriptVersion="2016-08-26 JAGR"
defaultPingTimer=4
targetIP=${1}
if [ -z "${2}" ]; then
pingTimer=${defaultPingTimer}
@jandahl
jandahl / dns.sh
Last active August 25, 2016 07:31
Use zone transfer to search for subdomains
#!/usr/bin/env bash
function aboutMe() {
echo -e "\n\t${scriptName}, v ${scriptVersion}"
echo -e "\n\tLooks through the ${lookupDomain} domain for what you want"
echo -e "\n\tTreats spaces as '.*'"
echo -e "\n\tExamples:"
echo -e "\n\t${scriptFile}${Emphasize} rt vrdb${ColorOff} will match rt01.vrdb"
echo -e "\t${scriptFile}${Emphasize} wireshark${ColorOff}\n"
# echo -e "(behind the scenes, it's a fancy ${Emphasize} dig -t AXFR tekdom.local | grep${ColorOff})\n"
#!/usr/bin/env bash
function aboutMe {
echo -e "\n\t$scriptName, v $scriptVersion"
echo -e "\n\tExamples:"
echo -e "\n\t$scriptFile \033[1;31mcurl\033[1;0m"
echo -e "\t$scriptFile \033[1;31msnmpdelta\033[1;0m\n"
echo -e "\n\tGenerates a rich text man page for you and opens it in Preview"
}
scriptFile=$(basename "$0")