Skip to content

Instantly share code, notes, and snippets.

View fredlahde's full-sized avatar
😁
Hey there!

Fred Lahde fredlahde

😁
Hey there!
View GitHub Profile
@fredlahde
fredlahde / git-review.sh
Last active February 5, 2021 15:27
Git review
git-review() {
local search="$1"
local commits=$(git --no-pager log --all --oneline --grep=$search | cut -d ' ' -f1 | paste -sd ' ')
if [ -z "$commits" ]
then
echo "No commits found for $search"
else
git show --pretty=short --show-signature $(echo $commits) | vim -
fi
}
@fredlahde
fredlahde / .zshrc
Created December 28, 2020 19:16
My .zshrc for ZSH with oh-my-zsh
# only relevant parts shown here
# Path to your oh-my-zsh installation.
export ZSH="/home/fredlahde/.oh-my-zsh"
# I'm using robbyrussell, mostly for its simplicity
ZSH_THEME="robbyrussell"
# I'm only using git as a plugin, for aliases and completion of git commands
plugins=(
package de.fredlahde.demoannotationprocessor;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.filter.AnnotationTypeFilter;
@fredlahde
fredlahde / curl_output
Created January 29, 2019 20:51
Spiegel.de https
$ curl -vLI https://spiegel.de
* Trying 128.65.210.8...
* TCP_NODELAY set
* Connected to spiegel.de (128.65.210.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
@fredlahde
fredlahde / phonebook.py
Last active January 17, 2019 14:56
Convert from google exported contacts csv to Fritz!Box xml for importing
import csv
header = ['Name', 'Given Name', 'Additional Name', 'Family Name', 'Yomi Name', 'Given Name Yomi', 'Additional Name Yomi', 'Family Name Yomi', 'Name Prefix', 'Name Suffix', 'Initials', 'Nickname', 'Short Name', 'Maiden Name', 'Birthday', 'Gender', 'Location', 'Billing Information', 'Directory Server', 'Mileage', 'Occupation', 'Hobby', 'Sensitivity', 'Priority', 'Subject', 'Notes', 'Language', 'Photo', 'Group Membership', 'E-mail 1 - Type', 'E-mail 1 - Value', 'E-mail 2 - Type', 'E-mail 2 - Value', 'E-mail 3 - Type', 'E-mail 3 - Value', 'IM 1 - Type', 'IM 1 - Service', 'IM 1 - Value', 'Phone 1 - Type', 'Phone 1 - Value', 'Phone 2 - Type', 'Phone 2 - Value', 'Phone 3 - Type', 'Phone 3 - Value', 'Address 1 - Type', 'Address 1 - Formatted', 'Address 1 - Street', 'Address 1 - City', 'Address 1 - PO Box', 'Address 1 - Region', 'Address 1 - Postal Code', 'Address 1 - Country', 'Address 1 - Extended Address', 'Organization 1 - Type', 'Organization 1 - Name', 'Organization 1 - Yomi Name', 'Organization 1 -
@fredlahde
fredlahde / main.go
Created July 6, 2018 22:04
Google Interview Questions - Aarray Multiplicator
package main
import "fmt"
/**
* There is an array A[N] of N numbers.
* You have to compose an array Output[N] such that Output[i]
* will be equal to multiplication of all the elements of A[N] except A[i].
* For example Output[0] will be multiplication of A[1] to A[N-1]
* and Output[1] will be multiplication of A[0] and from A[2] to A[N-1].
import org.junit.Test;
public class NextDateTest {
@Test
public void it_runs_correct_for_valid_date_in_a_leap_year() {
String[] testInput = new String[]{"29", "02", "2020"};
StdOutAsserter.assertAgainstStdOut(NextDate::main, testInput, s -> s.equals("Morgen ist der 1 . 3 . 2020\n"));
}
@Test
@fredlahde
fredlahde / IVKeystream.txt
Last active April 3, 2018 18:33
Keystream parser
Hinweis IV:050607 bedeutet IV[0]=05,IV[1]=06,IV[2]=07
IV: 02 01 C4 Schlüsselstrom: 02
IV: 03 01 C4 Schlüsselstrom: F8
IV: 03 FF 15 Schlüsselstrom: E0
IV: 03 FF 78 Schlüsselstrom: 54
IV: 02 01 A3 Schlüsselstrom: FC
IV: 02 01 F3 Schlüsselstrom: 73
IV: 03 FF 99 Schlüsselstrom: AA
IV: 02 01 0C Schlüsselstrom: CD
IV: 02 01 43 Schlüsselstrom: A1
@fredlahde
fredlahde / docker-setup.sh
Last active January 7, 2018 12:03
Docker & Docker Compose Ubuntu 17.10
#!/bin/bash
# docker
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
@fredlahde
fredlahde / main.go
Created December 14, 2017 19:18
GPL License Inserter
/*
* This file is part of the XXX distribution (https://github.com/xxxx or http://xxx.github.io).
* Copyright (c) 2015 Liviu Ionescu.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of