Skip to content

Instantly share code, notes, and snippets.

Julius Beckmann h4cc

  • ZENNER IoT Solutions
  • Hamburg, Germany
Block or report user

Report or block h4cc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@h4cc
h4cc / hhvm.config
Created Feb 5, 2014
Tiny hhvm JIT profiler test.
View hhvm.config
Eval {
Jit = true
}
@h4cc
h4cc / loglevels.md
Created Mar 5, 2014
Explanation and grouping of loglevels.
View loglevels.md

Log Levels - RFC 5424.


Internals

This levels only needs to be findable for debugging purposes.

@h4cc
h4cc / phpunit_assertDatesAreEqual.php
Created Mar 19, 2014
PHPUnit assertDatesAreEqual assertion.
View phpunit_assertDatesAreEqual.php
<?php
/**
* Check if two dates are "almost" equal.
*
* @param \DateTime $date1
* @param \DateTime $date2
* @param int $maxDiffSeconds
*/
public function assertDatesAreEqual(\DateTime $date1, \DateTime $date2, $maxDiffSeconds=59)
@h4cc
h4cc / generate_packages_json.php
Created Apr 23, 2014
Redirecting packages.json for Composer/Satis.
View generate_packages_json.php
<?php
/**
* This file generates a new package.json on STDOUT, that will
* include the other package.json files.
*
* @author Julius Beckmann <beckmann@silpion.de>
*
* Documentation on this:
* https://github.com/composer/composer/blob/c849f7d05d4eb5e585c34c83bd41341bc144f0d0/doc/05-repositories.md
@h4cc
h4cc / pathfinder.hh
Created Jun 3, 2014
Solution for the Programmierwetbewerb by Silpion for the Firmenkontaktmesse at FH-Wedel.
View pathfinder.hh
<?hh
/**
* Solution for the Programmierwetbewerb by Silpion
* for the Firmenkontaktmesse at FH-Wedel.
*
* @author Julius Beckmann
*
*/
type Point = Pair<int, int>;
@h4cc
h4cc / raw-thumbnails.md
Last active Aug 29, 2015
Using ufraw-batch for generating thumbnails in ubuntu.
View raw-thumbnails.md

Install

sudo apt-get install ufraw ufraw-batch

Create config

sudo vim /usr/share/thumbnailers/raw.thumbnailer

with content:

@h4cc
h4cc / apache2-servername-fix.sh
Created Jun 9, 2014
How to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName" Error on Ubuntu
View apache2-servername-fix.sh
# Write the ServerName for apache2 in a custom config file:
echo 'ServerName localhost' > /etc/apache2/conf.d/servername
# Restart d'a Server!
service apache2 restart
View jenkins.sh
which smartctl || sudo apt-get -y install smartmontools
which php || sudo apt-get -y install php5-cli
[ -f smart.php ] || wget https://gist.githubusercontent.com/h4cc/a2163b697469d847cd4a/raw/a04e2645d3c5f22625f3efaa28a4f604912b2792/smart.php
for disk in /dev/sd[a-z]
do
echo $disk
sudo smartctl --attributes $disk | php smart.php
done
@h4cc
h4cc / rotate.sh
Created Jul 14, 2014
Script for rotating the screen on my Thinkpad X200T.
View rotate.sh
#!/bin/sh
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
# Using current screen orientation proceed to rotate screen and input devices.
case "$rotation" in
@h4cc
h4cc / handy_commands.sh
Last active Aug 29, 2015
Handy Bash commands for every day usage.
View handy_commands.sh
# Some handy commands i dont like to google the way down every time:
# List files by changed timestamp in current folder
find . -type f -printf '%T@ %p\n' | sort -n -r | cut -f2- -d" " | sed -e 's,^./,,' | xargs ls -U -l
# Files writeable by "others" in current folder
find . -type d -perm /o+w
# Files writeable by current "group" in current folder
find . -type d -perm /g+w
# Files writeable by current "user" in current folder
You can’t perform that action at this time.