Skip to content

Instantly share code, notes, and snippets.

View uroesch's full-sized avatar

Urs Roesch uroesch

  • Puzzle ITC
  • Zurich, Switzerland
View GitHub Profile
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# Small script to rename the pi and group to a different one
# and also change the password.
# ------------------------------------------------------------------------------
declare -r OLD_USER=pi
declare -r OLD_GROUP=pi
declare -r NEW_USER=joedoe
@uroesch
uroesch / odiff
Created November 14, 2023 09:50
odiff script
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Setup
# -----------------------------------------------------------------------------
set -o errexit
set -o nounset
set -o pipefail
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# This script resturns the disk path and the WWN for a mount point
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Setup
# -----------------------------------------------------------------------------
set -o errexit
#!/usr/bin/env ruby
require 'rdoc'
require 'optparse'
class Debug
attr :on
def self.message message
return unless @on
@uroesch
uroesch / pp2md
Last active April 10, 2022 07:56
#!/usr/bin/env ruby
require 'rdoc'
require 'optparse'
class Debug
attr :on
def self.message message
return unless @on
@uroesch
uroesch / Anki Card Snippets.adoc
Last active January 15, 2022 20:47
Anki Cards and Snippets

Anki Card Snippets

Color feedback while typing

For a card with an input field. While typing the text color changes to green when correct and to red(ish) when wrong.

Card snippet
@uroesch
uroesch / .bashrc
Last active October 7, 2021 15:45
.bashrc setups with bitlets
# .bashrc include portion
if [[ -d ${HOME}/.bashrc.d ]]; then
for profile in $(find ${HOME}/.bashrc.d -type f -name "*.sh"); do
source ${profile}
done
fi
@uroesch
uroesch / .tmux.conf
Created September 22, 2021 13:16
tmux config
# ------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------
_status_format=' [#I] #W '
_status_bg=cyan
_status_fg=black
# ------------------------------------------------------------------------
# Key Bindings
# ------------------------------------------------------------------------
@uroesch
uroesch / pwgen.rb
Last active March 10, 2021 14:23
Ruby Script to generate random password an the hash for /etc/shadow
#!/usr/bin/env ruby [31/13189]
class PasswordFactory
SALT_LENGTH = 13
PW_LENGTH = 12
SALT_CHARS = (0..9).to_a + ('a'..'z').to_a + ('A'..'Z').to_a
PW_CHARS = SALT_CHARS
PREFIX_DEFAULT = '$6$'
PREFIX = {
sha512: '$6$',