Skip to content

Instantly share code, notes, and snippets.

View jandahl's full-sized avatar

Jan Gronemann jandahl

  • Spacepope
  • Denmark
View GitHub Profile
#!/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)"
@devdrops
devdrops / example.md
Last active March 25, 2024 15:09
Mysqldump from Docker container

Mysqldump from Docker container

docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql

OBS

  • This will generate a dump.sql file in your host machine. Awesome, eh?
  • Avoid using --compact on your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use --force to fix this scenario: recreate your dump without --compact ¯_(ツ)_/¯
@ckent
ckent / serial_bridge.c
Created June 1, 2015 15:15
Bridge an incoming socket to a serial port.
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <errno.h>
@ariesmcrae
ariesmcrae / ping.py
Last active July 30, 2023 10:07
Python3 script that will ping a list of servers in an external file. Output is unreachable_or_timeout.txt, server-not-found.txt, and server-ok.txt
import subprocess
import csv
def ping(hostname):
p = subprocess.Popen('ping ' + hostname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
pingStatus = 'ok';
for line in p.stdout:
output = line.rstrip().decode('UTF-8')
@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 $*