Skip to content

Instantly share code, notes, and snippets.

@drizzd
drizzd / GIT_RECENT.md
Last active April 13, 2019 13:45
git recent

git recent

git config --global alias.recent "branch --sort=committerdate --format '%(HEAD) %(if)%(HEAD)%(then)%(color:green)%(end)%(align:67)%(refname:short)%(end)%(color:reset)%(committerdate:short)'"

Example output:

$ git recent
@drizzd
drizzd / read.c
Last active October 3, 2018 08:22
bash read performance
#include <stdio.h>
#include <unistd.h>
#define BUFSIZE 8192
char buf[BUFSIZE];
int main()
{
while (1) {
int i;
i = read(0, buf, BUFSIZE);
if (i < 0) {
@drizzd
drizzd / timestamper.md
Created July 6, 2018 08:13
Timestamper

In the meantime I am using the following Python 2.7 script to add timestamps in the style of the Python logging module. Make sure to use Python's -u Option to disable output buffering.

$ python -u timestamper.py sh -c 'echo hey; sleep 1; echo ho'
2017-05-08 09:17:56.517 hey
2017-05-08 09:17:57.520 ho
# .gitlab-ci.yml
myjob:

script: "python -u timestamper.py ./myJob.sh"

@drizzd
drizzd / .gitconfig
Created January 10, 2017 13:50
git recent
[alias]
recent = for-each-ref --sort='committerdate' --format='%(committerdate:relative)%09%(refname:short)' refs/heads
#
# 2.1 if-Anweisungen
#
if Hunde == 5:
print('Viele Hunde')
if Hunde == 0:
print('Kein Hund')
@drizzd
drizzd / gist:7754428
Last active December 30, 2015 01:09
rssi.m
n = 10;
antA = randn(1, n);
antB = randn(1, n);
for i = 1:n
rssi = rssi + antA(i)^2;
rssi = rssi + antB(i)^2;
end
@drizzd
drizzd / git-notchanged
Created March 2, 2013 11:20
list files not changed by a git commit
#!/bin/bash
comm -23 <(git ls-tree --name-only -r "$1" | sort) <(git diff --name-only "$1"^! | sort)
@drizzd
drizzd / PKGBUILD
Created February 3, 2013 14:11
wagic-svn fix
# Contributor MCMic <mcmic@free.fr>
pkgname=wagic-svn
pkgver=0.17
pkgrel=3
pkgdesc="Wagic is an internationally acclaimed open source Trading Card Game simulation, made by card games fans and backed up by a large community of players and modders."
arch=('i686' 'x86_64')
url="http://wololo.net/wagic/download/"
license=('BSD')
depends=('qt')
@drizzd
drizzd / repr.m
Created October 7, 2012 16:22
pretty format matlab variable
function s = repr(x)
% REPR string representation
% s = repr(x)
%
switch class(x)
case 'function_handle'
s = ['@' func2str(x)];
case 'char'
s = ['''' x(:)' ''''];
0.0000000e+00 0.0000000e+00 0.0000000e+00
5.1015203e-05 1.0203041e-04 5.1530508e-07
2.0406081e-04 4.0812162e-04 3.0918305e-06
4.5913682e-04 9.1827365e-04 9.7907964e-06
8.1624324e-04 1.6324865e-03 2.2673423e-05
1.2753801e-03 2.5507601e-03 4.3800931e-05
1.8365473e-03 3.6730946e-03 7.5234541e-05
2.4997449e-03 4.9994898e-03 1.1903547e-04
3.2649730e-03 6.5299459e-03 1.7726495e-04
4.1322314e-03 8.2644628e-03 2.5198418e-04