Skip to content

Instantly share code, notes, and snippets.

View christian-draeger's full-sized avatar
free software, free society

Christian Dräger christian-draeger

free software, free society
View GitHub Profile
@christian-draeger
christian-draeger / extra-header.md
Last active August 21, 2020 15:04
add custom http-header to every outgoing request (system wide)

info: will only work for systems that use apache2 like most linux ones (path to httpd.conf may vary depending on OS)

check if httpd.conf exists

ls /etc/apache2/httpd.conf

open it and scroll to bottom of file:

Keybase proof

I hereby claim:

  • I am christian-draeger on github.
  • I am cdraeger (https://keybase.io/cdraeger) on keybase.
  • I have a public key ASAvgT5TAoeZbRWDYcZ6JkM9LdRVYmbp7WTAkL9YwgcBkwo

To claim this, I am signing this object:

@christian-draeger
christian-draeger / wait-for-it.sh
Created April 14, 2020 09:01
little bash script to wait until a given TCP host/port is available
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port is available
WAITFORIT_cmdname=${0##*/}
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
@christian-draeger
christian-draeger / Fibonacci.kt
Last active April 6, 2020 14:02
Calculate Fibonacci sequences in Kotlin as well as check if a number is a Fibonacci number. see: https://en.wikipedia.org/wiki/Fibonacci_number
class Fibonacci(number: Int = 100) {
val sequence = mutableListOf(0, 1, 1)
val isPartOfSequence by lazy { sequence.contains(number) }
init {
require(number <= 0) { "Only positive integers allowed in Fibonacci sequence." }
if (number > 1) {
var old = 1; var current = 1; var next: Int
while (current + (current / 2) <= number) {
@christian-draeger
christian-draeger / aliases.sh
Last active January 15, 2019 09:46
useful alias collection
# A shell alias is a shortcut to reference a command.
# It can be used to avoid typing long commands or as a means to correct incorrect input.
# Personally i really like to use the z-shell (ZSH), you can find plugins that provide
# aliases for certain tools.
# This Gist is a collection of aliases i wrote over the time and found them handy