Skip to content

Instantly share code, notes, and snippets.

View h4cc's full-sized avatar

Julius Beckmann h4cc

  • ZENNER IoT Solutions
  • Hamburg, Germany
View GitHub Profile
@h4cc
h4cc / vagrant_ubuntu_13_10.sh
Created November 28, 2013 08:44
Vagrant Ubuntu 13.10 one - liner
# Everything at once!
$ vagrant box add ubuntu1310 http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box && vagrant init ubuntu1310 && vagrant up && vagrant ssh
# Just Start and ssh into:
$ vagrant up && vagrant ssh
@h4cc
h4cc / munin_disable_warning.cmd
Created November 29, 2013 14:09
Disable warnings for a munin plugin
# Open the plugin configuration.
# Name is the same as filename under /etc/munin/plugins/{plugin_name}
$ /etc/munin/plugin-conf.d/{plugin_name}
# New Content:
[{plugin_name}]
env.warning 0
env.critical 0
@h4cc
h4cc / Makefile
Created December 1, 2013 12:01
Very simple Makefile to deploy a existing symfony2 application. Using Doctrine ORM and MongoDB ODM for database. Inital usage: $ git clone https://exaple.com/project.git $ make permissions Deploying or Updating with database changes: $ make deploy $ make database
hello:
@echo "Hello! use other targets!"
deploy:
git reset --hard -q
git pull -q
rm -rf bin/
php composer.phar install --no-progress --no-dev -o --quiet
rm -rf app/cache/*
@h4cc
h4cc / satis_install.sh
Last active February 13, 2024 16:39
Guide to install a satis server for composer. It can mirror packages and create a index for own packages.
# Install a Webserver
apt-get -y install apache2
# Target docroot to /home/satis/web/
# Install PHP5 CLI and needed programs.
apt-get -y install php5-cli php5-curl php5-json git wget
# Add a specifix user for our task
adduser satis
@h4cc
h4cc / sf2_annotations.md
Last active December 30, 2015 05:49
A list of Symfony2 Annotations with pro and cons.

Symfony2 Annotations

Something valuable for all annotation:

  • Getting rid of boilerplate code.
  • Configure, not coding.
  • Reusing existing features.

SensioFrameworkExtraBundle

@h4cc
h4cc / .bash_aliases
Last active December 31, 2015 14:49
Some Symfony2 and Composer aliases.
# Function for starting browser in background
browser() { firefox "$@" & }
#--- Composer
# Fetching latest composer version.
alias getcomposer='curl -s https://getcomposer.org/installer | php'
# Fetching latest composer version if not available and run it.
@h4cc
h4cc / ffmpeg.sh
Created January 1, 2014 17:51
ffmpeg slow down video to 10% and skip audio.
ffmpeg -i input.mov -vf "setpts=(1/10)*PTS" -an output.mov
@h4cc
h4cc / AbstractUser.php
Created January 8, 2014 08:45
JMS\Discriminator Example.
<?php
namespace Entity;
use JMS\Serializer\Annotation as JMS;
/**
* @JMS\Discriminator(field = "type", map = {
* "user": "Entity\User",
* "mod": "Entity\Moderator"
@h4cc
h4cc / branch_check.txt
Created January 14, 2014 08:38
Check if a git branch can be merged to another branch, without changing anything to the filesystem, except a generated .patch file.
# Replace branch names with for example:
# $targetBranch = master
# $sourceBranch = development
# Need to checkout target branch at least once
git checkout -q -f $targetBranch
# Create path file for source branch
git checkout -q -f $sourceBranch
rm -f branch-test.patch
@h4cc
h4cc / phpunit_sample.php
Created January 21, 2014 12:09
A few examples how to use PHPUnit. Covering Mock Objects, setUp Method, MockBuilder, @ExpectedException, @dataProvider
<?php
namespace Silpion\ExampleBundle\Tests\Listener\Serialization;
use Silpion\ExampleBundle\Entity\TextBlock;
use Silpion\ExampleBundle\Listener\Serialization\SerializationListener;
class SerializationListenerTest extends \PHPUnit_Framework_TestCase
{
/** @var SerializationListener */