Skip to content

Instantly share code, notes, and snippets.

View pschichtel's full-sized avatar

Phillip Schichtel pschichtel

View GitHub Profile
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)
@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>
@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 / 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 / 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 / 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 / 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 / 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 installation
Last active December 20, 2015 00:39 — forked from thanhhh/Redmine installation
How to configuration Redmine with puma and running on nginx (based on Gitlab's installation)
Add config/puma.ruby
--------------------
cd /home/redmine/redmine
sudo -u redmine -H curl --output config/puma.rb https://gist.github.com/quickwango/6043161/raw/fdfe2a865c3a0afe912c8784c971ea7ca3e64cfd/puma.rb
Install Init Script
--------------------
Download the init script (will be /etc/init.d/redmine):
@pschichtel
pschichtel / gist:4019519
Created November 5, 2012 18:43
example permissions definition
permissions:
essentials:
heal:
- create
- remove
sell:
- create
commands:
- *