Skip to content

Instantly share code, notes, and snippets.

View philipp-spiess's full-sized avatar

Philipp Spiess philipp-spiess

View GitHub Profile
def zeuge(a, n)
b = (n-1).to_s(2) # binary representation
d = 1
b.reverse.split('').each do |i|
d = (d*d) % n
if i.to_i == 1
d = (d*a) % n
end
puts "#{i}: #{d}"
@Test
public void testSeasonAndEpisodeNumberExtraction() {
LocalFileService localFileService = new LocalFileService()
File test1 = new File("Breaking.Bad.4.Days.Out.S02E09.mkv");
File test2 = new File("Breaking.Bad.4.Days.Out.02X09.mpg");
Assert.assertTrue(localFileService.hasPattern(test1));
Assert.assertTrue(localFileService.getSeason(test1) == 2);
Assert.assertTrue(localFileService.getEpisode(test1) == 9);
package sepm.ss15.e1325214.validators;
import sepm.ss15.e1325214.models.Jockey;
/**
* Specific validation behaviour for a jockey object
*
* @author philipp
*/
public class JockeyValidator extends Validator{
@philipp-spiess
philipp-spiess / fan-control
Last active October 5, 2015 16:09
Fan Control for NAS
#!/bin/bash
# case is closed
echo 0 > /sys/class/hwmon/hwmon2/device/intrusion0_alarm
# space seperated list of hdd's
HDDS="/dev/sdb"
CASE_FAN=0
for disk in $HDDS
do
@philipp-spiess
philipp-spiess / demo.json
Created November 7, 2015 08:57
API Demo
[
{
"id": "4de26e06814df7ebdc14af8b",
"name": "Vineapple Cafe",
"contact": {
"phone": "+13477991701",
"formattedPhone": "+1 347-799-1701",
"twitter": "VineappleCafe"
},
"location": {
@philipp-spiess
philipp-spiess / nginx.conf
Created November 20, 2015 00:38
RTMP2RTMP Proxy
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
meta copy;
push rtmp://live91.eu-dl.zencoder.io:1935/live/foobar;
}
@philipp-spiess
philipp-spiess / .rubocop.yml
Created December 17, 2015 11:16
Rubocop Config
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining
Metrics/LineLength:
@philipp-spiess
philipp-spiess / gist:e886251a3cd14adb7ee6
Created February 8, 2016 21:07
OSX Disable Auto Mounting
diskutil info /Volumes/HDD_NAME | grep "UUID"
sudo echo "UUID=12345678-1ABC-1CDE-1FGH-123456789012 none hfs rw,noauto" > /etc/fstab
@philipp-spiess
philipp-spiess / .gitignore
Last active June 23, 2016 16:23
PSPDFKit Chrome Theme
Cached Theme.pak