Skip to content

Instantly share code, notes, and snippets.

View danielmitd's full-sized avatar
🦄

Daniel Hartmann danielmitd

🦄
  • JobCloud AG
  • Zurich
  • 21:23 (UTC +01:00)
View GitHub Profile
@danielmitd
danielmitd / convert.php
Created December 18, 2015 13:48
cp1252-issue-test-case
<?php
$testData = [
"Senior IT Consultant / Project Manager &#8211; Pharma Industry f/m",
"Business Development Manager &#8211; High-Tech & Precision Manufacturing f/m",
"Comos Specialist &#8211; Pharma Engineering f/m",
"Medizintechniker/in 60 &#8211; 80%",
"Informatikrevisor/in &#8211; IT-Sicherheitsspezialist/in",
"Unterhaltsmechaniker/in 3&#8208;Schicht",
"Chef(fe) d&#39;équipe en Chauffage - Ventilation - Climatisation",
@danielmitd
danielmitd / git-up-all
Last active September 11, 2015 09:25
script to update all local git repositories in parallel
#!/bin/zsh
# place this in $PATH and then run:
# git up-all
# make it beautiful
autoload colors ; colors
GIT=`which git`
@danielmitd
danielmitd / damn-vote
Last active September 8, 2015 08:13
#!/usr/bin/env php
<?php
$people = [
'b2b' => [
'Dominik',
'Thomas',
'Henrik',
],
'b2c' => [
@danielmitd
danielmitd / map-match.php
Last active August 29, 2015 14:03
mapping match post codes
<?php
// read in translated city nam
$translations = [];
$languages = [ 1 => 'de', 2 => 'fr', 3 => 'it', 4 => 'rm' ];
$fp = fopen($argv[1], 'r');
while(false !== ($line = fgetcsv($fp, 1024, "\t"))) {
list(
// Primary key for postcode/town
@danielmitd
danielmitd / agent.conf
Last active August 29, 2015 14:02
apache combined log with cookie string
input {
file {
path => "/var/log/apache2/access.log"
type => "apache-access-cookies"
}
}
filter {
if [type] == "apache-access-cookies" {
grok {
@danielmitd
danielmitd / network-report.sh
Created June 6, 2014 14:01
report including network name for top ips
#!/bin/bash
TMP=$(mktemp)
TMP2=$(mktemp)
threshold="0.1"
awk '{ split($1, b, ","); a[b[1]]++ } END { for (d in a) { printf("%d %s\n", a[d], d) } }' | sort -nr > $TMP
sum=$(awk 'FNR==NR{sum+=$1;next}; END {print sum}' $TMP)
while read line; do
c=$(echo $line | awk '{ print $1 }')