Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
vierbergenlars / vid2mp3.php
Last active December 18, 2015 00:39
Convert video files to mp3 audio. Processes some videos simultaneous for better use of multi-core systems. Requires avconv.
#!/usr/bin/env php
<?php
// ##### START config
$files = glob('*.{mp4,flv}', GLOB_BRACE); // File types to convert to mp3 (video only)
$worker_num = 3; // number of cores +1
// ##### END config
$len = count($files);
$worker_pids = array();
function pr($s) {
#include <glob.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#define NUM_WORKERS 3
# 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):
<?php
namespace vierbergenlars\Norch\QueryParser;
class Lexer
{
/**
* This class should not be instanciated
*/
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
<?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] !== '#'; });
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'
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;}
plugins {
id 'eu.xenit.docker-alfresco' version '4.0.2'
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://artifacts.alfresco.com/nexus/content/groups/public/"
}
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;