Skip to content

Instantly share code, notes, and snippets.

Avatar

Raphael Beer rbeer

  • Berlin, Germany
View GitHub Profile
@rbeer
rbeer / gitup.sh
Created Apr 28, 2016
simple repo updater
View gitup.sh
#! /bin/env bash
# `gitup.repos` is a text file
# with one absolute path per line
if [ ! -e ./gitup.repos ]; then
echo "No repo list (gitup.repos) found!"
exit 1;
fi
@rbeer
rbeer / colors.sh
Created Jan 5, 2017
List bash colors in terminal
View colors.sh
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
@rbeer
rbeer / chrometd.sh
Created Jan 6, 2017
chrome-tab-doctor
View chrometd.sh
#!/usr/bin/env bash
# exit codes:
# - 0: ok
# - 1: unknown (fatal)
# - 2: no window found (fatal)
# $1 = key (sequence) to send
# allows + operand for concatenation, e.g. ctrl+e, alt+h
# use space for separation, e.g. "f o o"
@rbeer
rbeer / openssh-rdm.md
Last active May 20, 2017
ssh -L example
View openssh-rdm.md

$ ssh yourhost.com -L 7000:localhost:6379

 -----                         ----------------                          -----------------                         --------------
| RDM | -- localhost:7000 --> | OpenSSH, `ssh` | -- yourhost.com:22 --> | OpenSSH, `sshd` | -- localhost:6379 --> | redis-server |
 -----                         ----------------                          -----------------                         --------------
                (1)                                       (2)                                        (3)
@rbeer
rbeer / diff-repos.sh
Last active Jul 14, 2017
Diff working-tree of two git repositories, testing multiple branches
View diff-repos.sh
#! /usr/bin/env bash
_V="0.0.1"
function print_usage() {
printf '=%.0s' {1..80}; printf '\n'
echo "Diff Repos - $_V"
echo "Diff working-tree of two git repositories, testing multiple branches"
echo "Depends: ./diff-branches, write-access to ./"
echo "Usage: ./diff-repos.sh <repository_1> <repository_2> [-v]"
@rbeer
rbeer / README.md
Last active Oct 18, 2017
Saint Lague / Schepers committee seat distribution
View README.md

Webster/Sainte-Laguë/Schepers method

https://en.m.wikipedia.org/wiki/Webster/Sainte-Laguë_method

Calculates seat distribution of a committee, using the Webster/Sainte-Laguë/Schepers method for seat allocation.

It takes a number of seats in the committee and a set of parties with their number of seats in the actual parliament.

@rbeer
rbeer / lessls.sh
Created May 3, 2018
Less-ls; ls for directories, less for files - in one single `ls` alias
View lessls.sh
#!/bin/bash
LS_PATH=$1
function lsFallback() {
/bin/ls -alh --color=auto $LS_PATH
exit $?
}
if [ "$LS_PATH" == "" ]; then lsFallback; fi
@rbeer
rbeer / snarpshooter.sh
Last active Jan 23, 2022
Sna[r]pshooter - Take screenshots of specific windows
View snarpshooter.sh
#!/usr/bin/env bash
C_RED="\e[91m"
C_RESET="\e[0m"
function print_help {
echo "sna[r]pshooter - 1.0.0"
echo "Takes screenshot of a selected window, the whole screen or a selected region."
echo -e "Depends: ImageMagick's 'import', 'xwininfo'\n"
if [ -n "$1" ]; then
@rbeer
rbeer / ..ps1rc
Last active Apr 25, 2022
PS1 Themes
View ..ps1rc
### NOTE
Remove the first `.` from this file's name. Two `..` are necessary to name this gist correctly.
###
# [44/48]
# PS1Themes - v0.1.0
# Author: Raphael Beer <raphael.beer@protonmail.com>
# Dependencies:
# - bash
# - tput
@rbeer
rbeer / .git_aliases.sh
Last active Apr 25, 2022
Handy aliases for your everyday git workflow
View .git_aliases.sh
### Install
# 1. Download this file to ~/.git_aliases
# 2. Add `source ~/.git_aliases` to your ~/.bash_aliases or ~/.bashrc file
###
# git
# These aliases follow a simple scheme of 'git' and then
# the first letters of the command and its options.
# There are a few exceptions, like `gitaa` which means
# git add (all), i.e. `git add .`