Skip to content

Instantly share code, notes, and snippets.

View dedeibel's full-sized avatar

Benjamin Peter dedeibel

View GitHub Profile
#!/bin/bash
exec kdialog --title note --passivepopup "$*" 5
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 {
@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
@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 / make_my_icons.sh
Created May 15, 2016 09:37
Create an icons.c file for minidlna from a png instead of svg (modified original)
#!/bin/bash
#
# Generate a free icons.c for minidlna from Debian's SVG logo
#
# Copyright (C) 2011 Benoît Knecht <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
@dedeibel
dedeibel / sqlite-backup.sh
Created May 15, 2016 10:45
seafile sqlite db backup skript
#!/bin/bash
set -e
BASEDIR=/opt/seafile/mysite
OUTDIR=${BASEDIR}/backup/db
mkdir -p ${OUTDIR}
SUFFIX=.`date +"%Y-%m-%d-%H-%M-%S"`
sqlite3 ${BASEDIR}/ccnet/GroupMgr/groupmgr.db .dump | gzip > ${OUTDIR}/groupmgr.db.bak${SUFFIX}.gz
sqlite3 ${BASEDIR}/ccnet/PeerMgr/usermgr.db .dump | gzip > ${OUTDIR}/usermgr.db.bak${SUFFIX}.gz
sqlite3 ${BASEDIR}/seafile-data/seafile.db .dump | gzip > ${OUTDIR}/seafile.db.bak${SUFFIX}.gz
@dedeibel
dedeibel / access_report.sh
Created May 21, 2016 22:51
Create a goaccess report with the input of all access logs, including zipped ones in a given range e.g. the last week
#!/bin/bash
set -e
#set -x
# Tested on debian jessie
# Install goaccess
# Define your log format in /etc/goaccess.conf
# e.g log-format %h %^[%d:%^] "%r" %s %b "%R" "%u"
@dedeibel
dedeibel / dummy_java.sh
Last active May 22, 2016 18:41
install a dummy java so debian or ubuntu apt will be happy with an install oracle jdk - in this case for octave but should work for others too
#!/bin/bash
# deps:
# - have oracle jdk >= 7 build with java-package
# see https://wiki.debian.org/JavaPackage if you don't know how
# - apt-get install equivs
#
# Debian actually kind of suggests it but the doc ist kind of old:
# https://www.debian.org/doc/manuals/debian-java-faq/ch13.html
#
# inspired by RJ <[email protected]>
@dedeibel
dedeibel / Makefile
Created May 30, 2016 21:21
make print automatic variables
foo: foo.cpp bar.o
$(info @ is $@ )
$(info % is $% )
$(info < is $< )
$(info ? is $? )
$(info ^ is $^ )
$(info + is $+ )
$(info | is $| )
$(info * is $* )
${CXX} ${CXXFLAGS} -o $@ $<
@dedeibel
dedeibel / push-line.fish
Last active May 24, 2019 21:09
fish shell function to emulate zsh's push-line feature := store the current command and run one in between - restore the last command afterwards
# Save this file to ~/.config/fish/functions/push-line.fish
# Bind the function by using this in ~/.config/fish/functions/fish_user_key_bindings.fish
# function fish_user_key_bindings
# # For example alt+q
# bind \eq push-line
# end
function push-line
commandline -f kill-whole-line