Skip to content

Instantly share code, notes, and snippets.

View zburgermeiszter's full-sized avatar
👨‍💻
Available for Remote Senior Platform Engineer positions

Zoltan Burgermeiszter zburgermeiszter

👨‍💻
Available for Remote Senior Platform Engineer positions
View GitHub Profile
@zburgermeiszter
zburgermeiszter / Base64.php
Last active August 9, 2022 19:04
TWIG Base64 extension for Symfony
<?php
namespace Vendor\Bundle\Twig;
/*
services.yml:
twig.base64:
class: Vendor\Bundle\Twig\Base64
tags :
- { name: twig.extension }
@zburgermeiszter
zburgermeiszter / Md5.php
Last active March 23, 2020 10:00
TWIG MD5 extension for Symfony
<?php
namespace Vendor\Bundle\Twig;
/*
services.yml:
twig.md5:
class: Vendor\Bundle\Twig\Md5
tags :
- { name: twig.extension }
@zburgermeiszter
zburgermeiszter / Recursively generate MD5 checksums.txt
Created January 29, 2015 10:41
Recursively generate MD5 checksums
Recursively generate MD5 checksums
Posted 10-26-2011 at 10:53 AM by Garda
Tags find, md5, md5sum, xargs
I wanted to generate MD5 checksums of a whole bunch of files in a directory. It turns out that this is not as straightforward as it should be. IMO it should be completed with: md5sum -br *
Unfortunately it was not as straightforward. I found this blog entry after searching for a while and adapted this to what I needed. To generate checksums, I used the following:
Code:
find . -type f -print0 | xargs -0 md5sum -b
(Note: for the above to work, "cd" to the top level directiory, or use "find /home/username/folder/" instead of "find .")
@zburgermeiszter
zburgermeiszter / .gitconfig
Created January 30, 2015 09:55
.gitconfig
[core]
excludesfile = /home/user/git/.gitignore_global
autocrlf = input
[alias]
ls = log -30 --pretty=format:\"%C(yellow)%h %C(blue)%ad%C(red)%d %C(reset)%s%C(green) [%cn]\" --decorate --date=short
c = commit -am
co = checkout
b = branch
s = status
d = diff
@zburgermeiszter
zburgermeiszter / Useful Docker bash aliases
Last active August 18, 2016 10:35
Useful Docker bash aliases
#!~/.bashrc
# Get shell to a container by it's name.
function dsh() { docker exec -it $(docker ps | grep $1 | cut -d" " -f1) /bin/bash;}
function php() { docker run --rm -v $PWD:/php php:5.5 php /php/$1; }
function vssh {
vagrant ssh -c "sudo /bin/bash -c $1"
}
@zburgermeiszter
zburgermeiszter / luhn16.php
Created May 15, 2015 10:36
Luhn mod 16 checksum calculator
<?php
$input = "0B012722900021AC35B2";
$output = "0B012722900021AC35B21";
function luhn16($input) {
$codeArray = array();
$lastNumeric = array();
// Step 1: Code Point mapping (hex2int)
@zburgermeiszter
zburgermeiszter / hddled.sh
Created June 22, 2015 11:09
HDD led on Scroll Lock
#!/bin/bash
# Check interval seconds
CHECKINTERVAL=0.05
# console
CONSOLE=/dev/console
#indicator to use [caps, num, scroll]
INDICATOR=scroll
@zburgermeiszter
zburgermeiszter / Sending empty arrays with jquery to Symfony.js
Last active August 29, 2015 14:24
Sending empty arrays with jquery to Symfony
$.ajax({
url:postURL,
type:"POST",
data:JSON.stringify(data),
contentType:"application/json; charset=utf-8",
dataType:"json"
})
@zburgermeiszter
zburgermeiszter / overload.php
Last active August 29, 2015 14:27
Emulating method overloading with different signature.
<?php
// Link: https://ideone.com/JBQDNw
// PHP 5.4 required!
trait Overload {
public function overloadMe() {
$caller = debug_backtrace(false , 2)[1];
$function = $caller['function'];
@zburgermeiszter
zburgermeiszter / uk-mobile-regex.txt
Created September 22, 2015 10:33
UK mobile regex
^(07|447|\+447|00447)\d{9}$