Skip to content

Instantly share code, notes, and snippets.

Lars Vierbergen vierbergenlars

Block or report user

Report or block vierbergenlars

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
@vierbergenlars
vierbergenlars / docker-intercept.sh
Created Jan 23, 2019
Bridge a port that is exposed inside a container to your host
View docker-intercept.sh
#!/bin/bash
# Call as docker-intercept <container-name> <port-inside-container> <port-on-host>
set -e
container="$1"
container_port="$2"
host_port="$3"
network_id="$(docker inspect "$container" | jq '.[0].NetworkSettings.Networks | to_entries | .[0].value.NetworkID' -r)"
container_ip="$(docker inspect "$container" | jq '.[0].NetworkSettings.Networks | to_entries | .[0].value.IPAddress' -r)"
View AuthenticationHandler.java
package com.activiti.extension.bean.eu.xenit.xyz.repo.workflow.activiti;
import net.sf.acegisecurity.providers.dao.User;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.JavaDelegate;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.delegate.VariableScope;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
View build.gradle
plugins {
id 'eu.xenit.docker-alfresco' version '4.0.2'
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://artifacts.alfresco.com/nexus/content/groups/public/"
}
View statistics.sh
git ls-files | grep -v .jpg$ | grep -v .min.js$ | grep -v composer | grep -v views/errors | grep -v application/config | xargs -n1 git blame -w | ruby -n -e '$_ =~ /^.*\(([a-zA-Z ]+)\d{4}/; puts $1' | sed 's/ //g' | sort -f | uniq -c | sort -n
git log --no-merges --shortstat --use-mailmap --format='%aE' -- application/cache application/config application/controllers application/core application/helpers application/hooks application/index.html application/language application/libraries application/logs application/migrations application/models application/resources application/third_party application/views |sed 's/\(.*\)@.*/\1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\1 0 insertions\(+\), \2/;s/\(\+\)$/\(\+\), 0 deletions\(-\)/;s/insertions?\(\+\), //;s/ deletions?\(-\)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;}
View a-wp-update-notfier-crontab
0 0 * * 1 bash -c 'update_check=$($HOME/bin/wp core check-update --path=$HOME/apps/wordpress-main); if [[ ! "$update_check" =~ ^Success: ]]; then echo -e "Please update wordpress to the latest version.\n$update_check"| mail $USER -s "Wordpress update"; fi'
View migrate-dokuwiki-to-authserver.php
<?php
if($_SERVER['argc'] != 2) {
printf("%s dokuwiki_users\n", $_SERVER['argv'][0]);
echo "Converts all users found in the dokuwiki users.auth.php file 'dokuwiki_users'\n";
echo "to SQL to be imported in the authserver database. (on stdout) \n";
exit(1);
}
$dokuwikiUsers = file($_SERVER['argv'][1], FILE_SKIP_EMPTY_LINES|FILE_IGNORE_NEW_LINES);
$dokuwikiUsers = array_filter($dokuwikiUsers, function($line) { return $line[0] !== '#'; });
View gist:5459016b021ee604bd72
bad_trees=$(git fsck 2>&1 | awk '{print $4}' | sed s/://)
commits_with_bad_root_tree=$(git log --pretty=format:%H:%T | grep -E '('$(echo "$bad_trees" | tr "\n" '|' | sed s/.$//)')$' | cut -d: -f1)
echo "$bad_trees" | wc -l
echo "$commits_with_bad_root_tree" | wc -l
echo "$commits_with_bad_root_tree" | git log --stdin
View keybase.md

Keybase proof

I hereby claim:

  • I am vierbergenlars on github.
  • I am vierbergenlars (https://keybase.io/vierbergenlars) on keybase.
  • I have a public key whose fingerprint is 243F C82D 5D86 75D1 2A8D 76CD 00A9 3F8F 7577 7E8A

To claim this, I am signing this object:

View 01-lexer.php
<?php
namespace vierbergenlars\Norch\QueryParser;
class Lexer
{
/**
* This class should not be instanciated
*/
View gist:5772329
# Heapsort
class Heap:
def __init__(self, lst):
self.list = [len(lst)] + lst
k = self.poslastparent()
while k >= self.posroot():
self.sink(k)
k -= 1
def insert(self, val):
You can’t perform that action at this time.