Skip to content

Instantly share code, notes, and snippets.

View dedeibel's full-sized avatar

Benjamin Peter dedeibel

View GitHub Profile
@dedeibel
dedeibel / run.sh
Created March 7, 2018 12:40
Sane settings for running npm and karma on bamboo (no ascii, colors, unicode, progres …)
NPM_EXTRA_ARGS=
KARMA_EXTRA_ARGS=
echo "bamboo_buildNumber is '$bamboo_buildNumber'"
if [ -n "$bamboo_buildNumber" ]; then
echo "Using no color and no progress params"
NPM_EXTRA_ARGS="--progress false --color false --loglevel warn --unicode false"
KARMA_EXTRA_ARGS="--no-colors --reporters junit,coverage --no-auto-watch"
fi
@dedeibel
dedeibel / i3status_more_slim_number_format.patch
Created February 10, 2018 19:59
patch for i3status 2.11 with a slimmer number formatting
diff i3status-2.11/src/print_cpu_usage.c i3status-2.11_modified/src/print_cpu_usage.c
120c120
< outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark);
---
> outwalk += sprintf(outwalk, "%2d%s", diff_usage, pct_mark);
diff i3status-2.11/src/print_disk_info.c i3status-2.11_modified/src/print_disk_info.c
42c42
< return sprintf(outwalk, "%.1f %sB", size, symbols[exponent]);
---
> return sprintf(outwalk, "%.f %sB", size, symbols[exponent]);
@dedeibel
dedeibel / waitforssh
Last active July 1, 2019 16:31
wait until a given host has an open ssh port
#!/bin/bash
HOST=$*
until nc -vzw 2 "$HOST" 22; do sleep 2; done
@dedeibel
dedeibel / waitforhost
Last active July 1, 2019 16:30
wait until a given hostname responds to ping
#!/bin/bash
HOST=$*
while true; do ping -c1 "$HOST" > /dev/null && break; sleep 3 ; done
@dedeibel
dedeibel / gist:e2ab5c6589c07a9d925b9c58140932c0
Last active July 4, 2017 09:00
show git commits today / yesterday
git config --global alias.today '!git --no-pager log --pretty=format:"%ad - %s" --date=iso --date-order --reverse --all --since=6:00 --author=bpeter'
git config --global alias.yesterday '!git --no-pager log --pretty=format:"%ad - %s" --date=iso --date-order --reverse --all --since="yesterday 6:00" --until=6:00 --author=bpeter'
@dedeibel
dedeibel / .zshrc
Created May 21, 2017 10:50 — forked from meise/.zshrc
Configure bash variables based on directories
if [[ -e $HOME/.zsh/chpwd_profiles.zsh ]]; then
source $HOME/.zsh/chpwd_profiles.zsh
zstyle ":chpwd:profiles:/home/${USER}/projects(|/|/*)" profile projects
zstyle ":chpwd:profiles:(|/|/*)" profile default
# configuration for profile 'projects':
chpwd_profile_projects() {
[[ ${profile} == ${CHPWD_PROFILE} ]] && return 1
print "chpwd(): Switching to profile: $profile"
@dedeibel
dedeibel / convert-relative-ts-imports-to-absolute.pl
Created April 12, 2017 14:34
Converts module relative Agular 2 / Typescript Imports to tsconfig.json relative ones
#!/bin/perl
#
# Run on unix like Systems
#
# Execute this from the directory where your "tsconfig.json" and "app" resides as following:
#
# find . -name "*.ts" | xargs -n 1 perl convert.pl
#
# Add this to tslint.json 'compilerOptions'
#
@dedeibel
dedeibel / Makefile
Last active April 8, 2017 21:50
list all make targets to mark them as phony
list-phony:
@perl -ne 'push @a, $$1 if m/^([\w\d-]+):\s/; END { print ".PHONY: ", join(" ", sort @a), "\n" }' Makefile
@dedeibel
dedeibel / wait_for_postgres.sh
Created March 27, 2017 14:10
wait for postgresql server
#!/usr/bin/env bash
SERVICE="postgres"
DBNAME="mydb"
PORT="$1"
USER="$2"
PASS="$3"
MAX=30
IT=0
SLEEP_SECONDS=2
cat /proc/modules | cut -f 1 -d " " | while read module; do \
echo "Module: $module"; \
if [ -d "/sys/module/$module/parameters" ]; then \
ls /sys/module/$module/parameters/ | while read parameter; do \
echo -n "Parameter: $parameter --> "; \
cat /sys/module/$module/parameters/$parameter; \
done; \
fi; \
echo; \
done