Skip to content

Instantly share code, notes, and snippets.

@k-nut
k-nut / blablakarte.de.md
Last active August 29, 2015 14:13
Monothematische Karten
@k-nut
k-nut / booklist.md
Created April 14, 2016 19:18
Proposed books at first Programmers' Book Club Berlin

Proposed books at first Programmers' Book Club Berlin

  • The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win
  • Geek Sublime: The Beauty of Code, the Code of Beauty
  • Release It! Design and Deploy Production-Ready Software
  • Domain-Driven Design: Tackling Complexity in the Heart of Software
  • How to Stop Sucking and Be Awesome Instead
  • The Pragmatic Programmer: From Journeyman to Master
  • The Healthy Programmer - Get Fit, Feel Better, and Keep Coding
  • The Lean Startup
  • SQL Performance explained
@k-nut
k-nut / knowledge.md
Last active July 13, 2020 12:40
Knowledge I have gained throughout the years

vim

  • <n>G to jump to nth row
  • ctrl+o to jump to last curor position
  • ctrl+n to highlight word, again to jump to next one, ctrl-x to skip one ctrl-p to go back-
    • with plugin: c to change the selection
  • q: to get a window of all last commands <CR> to execute them
  • J to move the following line to the end of this line
  • <leader>s to substitute word under cursor
  • "dd deleted line into register
# -*- coding: utf-8 -*-
import pywikibot
import json
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
def set_active(politican_item_id):
item = pywikibot.ItemPage(repo, politican_item_id)
claims = item.get()['claims']['P39']
@k-nut
k-nut / landtagify.py
Last active December 3, 2016 21:20
Add a Politician to the 16th Landtag in NRW
# -*- coding: utf-8 -*-
import pywikibot
import json
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
def mark_as_part_of_current_landtag(politican_item_id):
item = pywikibot.ItemPage(repo, politican_item_id)
claims = item.get()['claims']['P39']
@k-nut
k-nut / create_politician.py
Created December 4, 2016 09:14
Create a new politician
import pywikibot
def create_bavarian_politician(name):
"""
Creates a new entry in test.wikdata.org
:return:
"""
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
SUMMARY:Registrierung der Teilnehmenden
DTSTART;TZID=Europe/Berlin:20170428T090000
DTEND;TZID=Europe/Berlin:20170428T100000
STATUS:CONFIRMED
SEQUENCE:1
END:VEVENT
let targetDate = new Date(2017, 8, 26, 0, 0, 0, 0)
let rem = Application('Reminders').lists.byName('Test').reminders();
rem
.filter(reminder => reminder.completionDate() < targetDate)
.map(reminder => reminder.name());
@k-nut
k-nut / reorder-duplex-scan.sh
Created April 21, 2018 06:37
Turn a scanned duplex pdf [1,2,3,5,6,4] into the correct order [1,2,3,4,5,6]
#!/bin/sh
FILENAME="$1"
COUNT=$(pdfinfo "$FILENAME" | awk '$1 == "Pages:" {print $2}')
HALF=$((COUNT/2))
ARGUMENTS=""
for i in $(seq 1 $HALF)
do
ARGUMENTS="$ARGUMENTS Reorder-Page-$i.pdf"
done
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.