Skip to content

Instantly share code, notes, and snippets.

View dedeibel's full-sized avatar

Benjamin Peter dedeibel

View GitHub Profile
@dedeibel
dedeibel / gist:bdded145138a60fabd067e12c6a6a548
Created April 6, 2016 15:15
Extracts play (1.2) Database evolution script "Up" Parts from the evolution files
cd conf/evolutions/default
mkdir ../extracted
for i in *.sql ; do awk '/# --- !Ups/{flag=1;next}/# --- !Downs/{flag=0}flag' "$i" > ../extracted/"$i" ; done
@dedeibel
dedeibel / write-git-info.sh
Created April 6, 2016 15:05
Simply get some git info of the current commit to include in your app
#!/usr/bin/env bash
git log -1 --format='format:git.hash="%H"
git.date="%ci"
git.ref="%d"' > include.git.conf
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
public class MyMatchersTest {
@Test
public void testSameAsSet() throws Exception {
#!/bin/bash
exec kdialog --title note --passivepopup "$*" 5
#!/bin/bash
PID=$1
if [ -z "$PID" ]; then
echo "no PID given"
exit 1
fi
while [[ ( -d "/proc/$PID" ) && ( -z `grep zombie "/proc/$PID/status"` ) ]]; do
sleep 0.5
done
#!/bin/bash
fifo_name=$1;
if [ -z "$1" ]; then
echo "Usage "`basename $0`": <PATH>"
exit 1
fi
[ -p "$fifo_name" ] || mkfifo "$fifo_name";
chmod a+rw "$fifo_name"
#!/bin/bash
fifo_name=$1;
if [ -z "$1" ]; then
echo "Usage "`basename $0`": <PATH>"
exit 1
fi
[ -p "$fifo_name" ] || mkfifo "$fifo_name";
chmod a+rw "$fifo_name"
@dedeibel
dedeibel / portopen
Created October 7, 2014 14:13
check if single port is open
nmap -sS -p 5222 --open chat.hipchat.com | grep open 2>&1 > /dev/null
@dedeibel
dedeibel / crontab
Created September 18, 2014 08:06
backup crontab
# m h dom mon dow command
30 12 * * Mon,Wed,Fri /usr/bin/withbackupdevice /usr/bin/backup
# Every first tuesday
30 12 * * * [ `/bin/date +%u` -eq 2 -a `/bin/date +%e` -lt 8 ] && /usr/bin/withbackupdevice /usr/bin/archive
@dedeibel
dedeibel / withbackupdevice
Created September 18, 2014 08:01
mount a network share before doing a specified action and umount it afterwards (see also backup and archive)
#!/bin/bash
#set -x
function failure() {
echo "backup failed " `date` >> /var/log/backup-mount-`date +%Y-%m-%d`
exit
}
function kill_childs() {