Skip to content

Instantly share code, notes, and snippets.

View pschichtel's full-sized avatar

Phillip Schichtel pschichtel

View GitHub Profile
@pschichtel
pschichtel / puma.rb
Last active December 20, 2015 00:39 — forked from thanhhh/puma.rb
default puma configuration for Redmine, but can be used for any ruby app
#!/usr/bin/env puma
# Start Puma with next command:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
# uncomment and customize to run in non-root path
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/redmine"
application_path = '/home/redmine/redmine'
@pschichtel
pschichtel / redmine
Created July 19, 2013 23:54 — forked from thanhhh/redmine
init script for redmine, but can easily be used for other ruby apps using puma
#! /bin/bash
# REDMINE
# Maintainer: @thanhhh
# App Version: 2.3.1
APP_ROOT="/home/redmine/redmine"
APP_USER="redmine"
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb"
PID_PATH="$APP_ROOT/tmp/pids"
@pschichtel
pschichtel / build_dmg.sh
Created March 23, 2015 21:50
Generates a .dmg file from an .app folder on Linux. hfsutils as well as root permissions are required to use this.
#!/bin/bash
app_path="${1?No app source path given}"
app_name="$(basename "$app_path" | sed -r "s/\.app$//g")"
echo "$app_name"
dmg_size="$(du -ms "$app_path" | grep -oP "^\d+")"
dmg_path=$(sed -r "s/\.app\/?$/.dmg/g" <<< "$app_path")
@pschichtel
pschichtel / add_domain.sh
Last active August 29, 2015 14:22
Adds a new domain to the opendkim configuration
key=${1?No domain key given!}
domain=${2?No domain name given!}
opendkim_base="/etc/opendkim"
opendkim_user="opendkim"
opendkim_group="opendkim"
key_path="${opendkim_base}/keys/${domain}"
mkdir -p "$key_path"
@pschichtel
pschichtel / fix_gitlab.sh
Created June 11, 2015 20:09
This bash script fixes up the repositories in gitlab after restoring a backup in a new gitlab instance
#!/bin/bash
gitlab_user="git"
if [[ "$(whoami)" == "$gitlab_user" ]]
then
echo "Searching for errors and corecting them"
else
echo "Nope, wrong user. Trying to login as $gitlab_user"
su "$gitlab_user" -c "$0"
@pschichtel
pschichtel / ShellPong.java
Last active August 29, 2015 14:24
javac ShellPong.java && java -cp . ShellPong; rm ShellPong*.class
public class ShellPong {
private static final int width = 80;
private static final int height = 24;
private static final char CORNER = '+';
private static final char H_WALL = '-';
private static final char V_WALL = '|';
private static final char PADDLE = '#';
private static final char BALL = 'O';
@pschichtel
pschichtel / nginx_rtmp.conf
Created October 3, 2015 15:05
A nginx configuration adding an RTMP server for collection of multiple streams from the local network
rtmp {
server {
listen 0.0.0.0:1935;
chunk_size 4096;
# The collection server, streaming allowed from standard local /16 subnets
# Stream to rtmp://<server ip>/collect/<stream key>
import scala.io.Source._
import java.lang.Character.{isWhitespace => isSpace}
import scala.annotation.tailrec
def parseLine(s: String): (String, Seq[String]) = {
parseCommand(s.iterator)
}
def parseCommand(s: Iterator[Char]): (String, Seq[String]) = {
val elements = parseElements(s)
[Unit]
Description=Loads the VirtualBox kernel modules
[Service]
Type=oneshot
ExecStart=/sbin/rcvboxdrv setup
[Install]
RequiredBy=multi-user.target
@pschichtel
pschichtel / daemon.conf
Last active December 29, 2015 12:12
My PulseAudio Daemon Configuration configured for high quality upsampling. alsa-plugins, libsamplerate and pulseaudio >= 2.0 are required for this
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU