Skip to content

Instantly share code, notes, and snippets.

@IsoLinearCHiP
IsoLinearCHiP / update-ddns.rb
Last active October 20, 2025 15:22 — forked from sixtyfive/update-ddns.rb
DIY dDNS service script using Hetzner's DNS API
#!/usr/bin/env ruby
# on OpenRC systems, place into e.g. /etc/periodic/15min
# (or create /etc/periodic/1min and add line to root's crontab)
# on systemd systems, install it as a timer
# create/find these in Hetzner's DNS admin interface at https://dns.hetzner.com/
API_TOKEN_NAME="..."
API_TOKEN="..."
ZONES=["...", "..."] # TLD; must be registered at https://robot.hetzner.com/domain
@IsoLinearCHiP
IsoLinearCHiP / ansible.cfg
Last active August 29, 2015 14:19
initial setup of ansible access
[defaults]
# without "merge" you cant have defaults for the group
hash_behaviour=merge
@IsoLinearCHiP
IsoLinearCHiP / indent_tools.vim
Last active August 29, 2015 14:19
Vim functions for indentation conversion
" Functions to convert between tab indenting and space indenting
" in contrast to :retab! it only replaces indentation at the line start.
"
" adapted from http://stackoverflow.com/a/5173322/1673337
"
" Example:
" set tabstop=1 | call RetabToTab() | set tabstop=2 | RetabToSpace()
"
" would solve my common problem of reindenting a file from 1 space to 2 spaces per level
@IsoLinearCHiP
IsoLinearCHiP / ldif_de64.awk
Created March 19, 2015 18:04
LDIF filter in awk and some companion scripts
#!/usr/bin/awk -f
/^\w+:.+/ || /^$/ {
if(b64) {
obc=0
printf attr" "
for(i=1;i<=length(b64);i++) {
c=index( \
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", \
@IsoLinearCHiP
IsoLinearCHiP / shell_register_demo.yml
Created February 24, 2015 19:40
registering output from shell, normal, with_items, with_dict
---
- hosts: all
gather_facts: no
connection: local
sudo: no
tasks:
# single
- shell: /bin/echo foo
register: somevar_single
- debug: var=somevar_single
@IsoLinearCHiP
IsoLinearCHiP / .screenrc
Created November 20, 2014 22:24
Proper Terminal colors in tmux and screen
# Append this to screenrc
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
term screen-256color
# Optionally: use current bg color for erased chars
# defbce on
@IsoLinearCHiP
IsoLinearCHiP / gist:ccd718e16cbc774e6dfd
Created November 7, 2014 16:05
oneliner for SSH Host fingerprints, hostname and IP
echo "$(hostname): "; ip a | sed -n "/inet.*eth./ p"; for f in /etc/ssh/ssh_host_*_key; do echo -n "$f: "; ssh-keygen -l -f $f; done
@IsoLinearCHiP
IsoLinearCHiP / HOWTO.md
Created October 29, 2014 20:22
Setup a SSH gateway hop

Setting up a multihop ssh connection with Putty

  • In the "hostname" field in putty set the real target address (this must be resolvable by the gateway host)
  • Under Connection->Proxy select proxy type "local"
  • Enter the gateway address (as resolvable by the client computer) into the "Proxy hostname" field
  • enter the username and possibly password for the gateway
  • in the "telnet command, or local proxy command" field enter "plink -agent -l %user %proxyhost -nc %host:%port"
  • this oviously requires you to have plink either in the same folder as putty or within the global windows searchpath
  • Under Conntion->Data optionally enter the username for the target machine
@IsoLinearCHiP
IsoLinearCHiP / ppid()
Last active August 29, 2015 14:07
Bash, get ppid
ppid() { { if [ -z $1 ]; then read -p "PID: " pid; fi; ps -p ${pid:-$$} -o ppid= ;} | awk '{print $1}' ;}