Skip to content

Instantly share code, notes, and snippets.

@LukasKnuth
LukasKnuth / README
Created February 15, 2012 22:18
This Python script can be used as a "pre-commit"-hook, to check if a huge binary file got accidentally added to the staging area (and is about to be committed). Because deleting those afterwards is a huge pain in the ass...
-- DESCRIPTION --
If you accidentally commit a huge file, you have a problem. Sure, you can remove it from the working tree and commit,
but the file is still reachable from your history and therefore causes every clone to be as huge as the commented
binary file.
Fixing this can be very ugly, time consuming and might not even work as you wish. Luckily, this script can protect
you from committing such monsters in the first place.
It looks through the staged files (the ones that are added with the "git add"-command) and checks for their file-size.
If they are larger then the given size, the commit is aborted and you get a message telling you what file takes so
@LukasKnuth
LukasKnuth / Readme.md
Created December 6, 2019 21:47
ffmpeg Merge two Audio Streams into one

This script takes a single input file and

  1. Reduces the volume of the third audio-track in the file by half
  2. Writes the reduced volume track into l
  3. Mixes both the second audio-track and the lowered l-track together and stores them into a
  4. Maps the original video to be the first track
  5. Adds the newly mixed audio-track a as the sole audio track
  6. Enables pass-through for the video-track
  7. Configures the mixed audio-track to be AAC at 192kbit/s
@LukasKnuth
LukasKnuth / fix_arrow_pipe.json
Created May 16, 2022 07:17
Karabiner Elements "complex modification" to fix the arrow-brackets (<>) and pipe (|) keys when using the "German Standard" layout in OSX
{
"title": "Personal fixes - Moonlander",
"rules": [
{
"description": "Fixes both Arrow-brackets and the Pipe symbol on the Moonlander keyboard with German layout.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "non_us_backslash"
@LukasKnuth
LukasKnuth / TTS.java
Created June 14, 2014 14:59
A TTS (Text-To-Speech) wrapper with extended functionality, designed to be robust and easy to use.
import android.annotation.TargetApi;
import android.content.Context;
import android.media.AudioManager;
import android.os.Build;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
import android.util.Log;
import java.util.HashMap;
@LukasKnuth
LukasKnuth / gist:40c53447ff0c980297c010939a6b9cdd
Created July 20, 2020 11:07
Encode to H265, no quality loss
#!/bin/bash
function encode {
# Add a "?" at the end of a "map" to say "if available"
# For a preview: add "-ss 0" before "-i" and "-t 120" before the output file. This gives a 2min sample
ffmpeg -hide_banner \
-i "$1" \
-map_metadata 0 \
-map_chapters 0 \
-metadata title="$2" \
-map 0 \
# This is a BoxStarter Script. See https://boxstarter.org/
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Disable-GameBarTips
Disable-BingSearch
# Install Basics
cinst -y firefox 7zip cpu-z windirstat hwmonitor choco-cleaner
# Install Multimedia
# This is a BoxStarter Script. See https://boxstarter.org/
### BEFORE
#
# * Make sure this is run on Windows 10 Pro (required for Hyper-V)
# * Enable Virtualization in BIOS/UEFI (required for Hyper-V)
# Basic Configuration
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Disable-GameBarTips
@LukasKnuth
LukasKnuth / README
Created March 7, 2012 10:40
A simple script that helps setting up your portable tools in the msysgit-shell.
-- Add Portable software to your msysgit-PATH --
If you like to work with your *nix shell even under Windows, you'll
likely use the git-bash provided by msysgit a lot.
A problem might be, that you don't have your tools in the PATH of that
shell and therefore can't use them. Those tools might be on the same
USB-drive as the git-shell, so you would have to adjust the PATH
(if you're allowed to) every time the drive-letter changes.
@LukasKnuth
LukasKnuth / PKGBUILD
Created December 25, 2013 12:10
Updated PKGBUILD for the leap motion drivers.
# Maintainer: Helge Rausch <helge@rausch.io>
# This script is licensed under the MIT license.
# https://gist.github.com/tsujigiri/5476281
#
## Installation
#
# To install the Leap software, you first need to download the SDK for Linux
# from https://developer.leapmotion.com/downloads/leap-motion/sdk using your
# developer account. Unpack it, place the included .deb files in the same
# directory as this PKGBUILD and run `makepkg`. If all goes well this will
@LukasKnuth
LukasKnuth / session.log.old
Created November 16, 2012 01:21
session.log
/etc/gdm/Xsession: Beginning session setup...
localuser:luke being added to access control list
/etc/gdm/Xsession: Setup done, will execute: /usr/bin/ssh-agent -- gnome-session
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-9wq22l
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-9wq22l
SSH_AUTH_SOCK=/run/user/1000/keyring-9wq22l/ssh
GPG_AGENT_INFO=/run/user/1000/keyring-9wq22l/gpg:0:1
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-9wq22l
SSH_AUTH_SOCK=/run/user/1000/keyring-9wq22l/ssh
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-9wq22l