Skip to content

Instantly share code, notes, and snippets.

View cg3's full-sized avatar

Christian Götz cg3

View GitHub Profile
@cg3
cg3 / mjpg_streamer.sh
Created July 12, 2018 20:53 — forked from fishkingsin/mjpg_streamer.sh
raspberry pi mjpg_streamer startup script
#!/bin/sh
# /etc/init.d/mjpg_streamer.sh
# v0.2 phillips321.co.uk
### BEGIN INIT INFO
# Provides: mjpg_streamer.sh
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mjpg_streamer for webcam
@cg3
cg3 / autoload.php
Last active December 25, 2015 02:38
autoload file for php
<?php
spl_autoload_register('load_api');
function loadFileCache()
{
if(!file_exists(dirname(__FILE__) . '/cache.dat')) {
return array();
}
$s = file_get_contents(dirname(__FILE__) . '/cache.dat');
@cg3
cg3 / gist:6698240
Created September 25, 2013 11:18
change param in config file on-the-fly
Param = "Value"
sed -r "s/(Param *= *\").*/\1NewVal\"/" c.conf
Param Value
sed -r "s/(Param *).*/\1NewVal/" c.conf
@cg3
cg3 / gist:6649447
Created September 21, 2013 10:52
Add Autocomplete to Netbeans for Phpunit
Add the PHPUnit directory to NetBeans's PHP global include path. This will provide code completion in NetBeans for all projects.
Open Tools : Options
Switch to the PHP tab
Click Add Folder... next to the Global Include Path box
Enter /usr/share/php/PHPUnit or navigate to where PEAR installed PHPUnit's source files
Click Open
Click OK
@cg3
cg3 / TestHelper.php
Created September 20, 2013 06:38
Test private/ protected methods via Reflection
<?php
class TestHelper
{
public static function callProtectedMethod($obj, $methodName, array $args)
{
$class = new \ReflectionClass($obj);
$method = $class->getMethod($methodName);
$method->setAccessible(true);
@cg3
cg3 / gist:6520365
Created September 11, 2013 07:32
connect to existing repo and pull
cd existing_git_repo
git remote add origin [email protected]:caius/foo.git
git config --add branch.master.remote origin
git config --add branch.master.merge refs/heads/master
git pull
@cg3
cg3 / gist:6402976
Last active December 22, 2015 02:19
add ServerName to apache2 config
echo ServerName $HOSTNAME > /etc/apache2/conf.d/fqdn
or
echo ServerName $HOSTNAME > /etc/apache2/conf-enabled/fqdn.conf