Skip to content

Instantly share code, notes, and snippets.

View kaeff's full-sized avatar

Klaus Fl kaeff

View GitHub Profile
class Car {
this.engine;
ignite() {
this.engine.turnOn();
}
accelerate() {}
getPostiion() {}
turnLeft() {}
turnOff() {
@kaeff
kaeff / delete-readability.js
Created August 30, 2018 14:50
Delete Readability entries from Kindle
// Snippets to be copy/pasted in the JS console on Amazon's "my content and devices" page
// Do this once
NodeList.prototype.forEach = Array.prototype.forEach;
// Paste this to select the entries. Then click "delete" and confirm
document.querySelectorAll("*[title='Readability.']").forEach((el) => el.closest(".contentTableListRow_myx").querySelector("i.listViewIconPosition_myx").click())
@kaeff
kaeff / -
Created March 16, 2018 11:40
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title></title>
<style type="text/css">
ReadMsgBody {
width: 100%;
}
@kaeff
kaeff / apps-missing-from-brew.sh
Created March 2, 2017 13:02
Utility to find apps which are missing from `brew list` although installed
#!/bin/bash
brew cask list | sed 's/ +/\n/g' | sort > apps-cask.txt
ls -l /Applications | cut -c 55- | grep -v '\->' | sed 's/ /-/g' | sed 's/\.app//g' | awk '{print tolower($0)}' | sort > apps.txt
comm -23 apps.txt apps-cask.txt > apps-not-installed-by-brew.txt
ls /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/Casks | sed 's/\.rb//' > all-casks.txt
comm -12 apps-not-installed-by-brew.txt all-casks.txt > apps-missing-from-brew.txt
cat apps-missing-from-brew.txt
@kaeff
kaeff / dl-lesson.sh
Created November 18, 2016 09:28
Download an egghead.io lesson using youtube-dl
#!/bin/bash
# Usage: dl-lession.sh https://egghead.io/courses/react-fundamentals
let n=1
for link in $(curl -s $1 | pup '.series-lessons-list a attr{href}'); do
filename=$(echo $link | sed "s/https:\/\/egghead.io\/lessons\///g" | sed "s/\?.*$//g")
filename_numbered=$(echo "$n $filename" | awk '{ printf "%02i-%s.mp4\n", $1, $2 }')
youtube-dl -o "$filename_numbered" "$link"
let n++
done
@kaeff
kaeff / wazokazi.log
Created October 15, 2015 11:41
when I open christophs "re: accounts created" mail
2015-10-15 10:13:35 [twisted] CRITICAL Unhandled error in Deferred:
Traceback (most recent call last):
File "/usr/share/python/pixelated-user-agent/lib/python2.7/site-packages/twisted/internet/defer.py", line 1274, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
File "/usr/share/python/pixelated-user-agent/lib/python2.7/site-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
result = g.send(result)
File "/usr/share/python/pixelated-user-agent/lib/python2.7/site-packages/pixelated_user_agent-0.1-py2.7.egg/pixelated/adapter/mailstore/leap_mailstore.py", line 348, in _leap_message_to_leap_mail
body = yield self._raw_message_body(message)
class InviteCode < CouchRest::Model::Base
use_database :invite_codes
design do
view :by__id
end
end
require 'gosu'
# The game skeleton we built on 16.6. - A ball moving right to left and back, slowly invading the bottom of the screen...
class GameWindow < Gosu::Window
def initialize
super(640, 480)
self.caption = "Gosu Tutorial Game (Interval: #{self.update_interval})"
@ball = Gosu::Image.new('media/ball.png')
@kaeff
kaeff / git-whatchanged.sh
Created May 4, 2015 08:42
A script listing the commit ranges applied during `git pull --rebase`, one line per pull in descending order
#!/usr/bin/env bash
git reflog | grep -A 1 "pull --rebase: checkout" | ruby -e 'puts STDIN.each_slice(3).map {|a| a.take(2).reverse.map {|l| l.split(" ").first}.join("..") }'
@kaeff
kaeff / global_assert.js
Last active August 29, 2015 14:19
Global Assert
global.assert = require('assert');