Skip to content

Instantly share code, notes, and snippets.

git log --since=4.weeks --numstat --pretty="%ae %H" | sed 's/@.*//g' | awk '{ if (NF == 1){ name = $1}; if(NF == 3) {plus[name] += $1; minus[name] += $2}} END { for (name in plus) {print name": +"plus[name]" -"minus[name]}}' | sort -k2 -gr
@Niklas9
Niklas9 / aws_parse_n_sync.py
Last active October 1, 2018 21:37
sync diff items in AWS S3 buckets
#!/bin/python
import os
import sys
if not len(sys.argv) == 3:
print('need two input args, source and target files')
@Niklas9
Niklas9 / mount_vmware_fusion_shared_folder.sh
Last active October 1, 2018 16:03
VMware fusion share folder between VM and macOS
#!/bin/sh
# more info - https://github.com/vmware/open-vm-tools/issues/199
# 1st share the folder in the VM settings in vmware fusion
# 2nd install vmware tools
sudo apt-get install open-vm-tools
# 3rd create the mount point
@Niklas9
Niklas9 / twilio_csv_find_most_frequent_numbers.py
Created September 11, 2018 16:29
Find most frequent numbers from a Twilio CSV export
#!/usr/bin/python3
import csv
import operator
import sys
if len(sys.argv) < 2:
print('need csv file as first arg')
sys.exit(1)

Keybase proof

I hereby claim:

  • I am niklas9 on github.
  • I am niklas9 (https://keybase.io/niklas9) on keybase.
  • I have a public key ASBhR2j3od8lmEjb8Y8OHXdjFo4MXo_1xdXKS6HXAYo-FQo

To claim this, I am signing this object:

@Niklas9
Niklas9 / untar_inplace.sh
Last active September 15, 2017 20:22
shell script to extract files in-place from a tar archive
#!/bin/bash
if [ $# -eq 0 ]
then
echo "missing argument for file path to tar-archive"
exit 1
fi
for file in $(tar -tf $1);
do
@Niklas9
Niklas9 / memusg
Created September 24, 2013 07:21 — forked from netj/memusg
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }
@Niklas9
Niklas9 / non-async-tests-mongoose.js
Last active June 29, 2016 17:51
using wait.for to do synchronous gets from MongoDB using Mongoose
var mongoose = require('mongoose');
var wait = require('wait.for');
mongoose.connect('localhost', 'non_async_tests');
var itemSchema = new mongoose.Schema({
name: String
});
var Item = mongoose.model("Item", itemSchema);