Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / ffmpeg-scale-video.md
Created January 14, 2021 22:09
Resize / scale a video with FFmpeg
View ffmpeg-scale-video.md

Resize / scale a video with FFmpeg

  • Scale the input.mp4 to a height of 600px.
  • Let FFmpeg choose a number which is divisible by 2 to avoid the not divisible by 2 error.
ffmpeg -i input.mp4 -vf scale=-2:600,setsar=1:1 ouput.mp4
@johnjohndoe
johnjohndoe / Google-tax-number-and-address.md
Created April 22, 2014 07:19
Google / German tax number and address
View Google-tax-number-and-address.md
@johnjohndoe
johnjohndoe / shuffle-keys.py
Created March 8, 2023 10:07
This script enables/disables the public/private keys for work and hobby.
View shuffle-keys.py
#!/bin/python3
#
# This script enables/disables the public/private keys for work and hobby.
import os
ACTIVATED_PRI = "/home/USERNAME/.ssh/id_ed25519"
ACTIVATED_PUB = "/home/USERNAME/.ssh/id_ed25519.pub"
INACTIVE_HOBBY_PRI = "/home/USERNAME/.ssh/id_ed25519.HOBBY"
@johnjohndoe
johnjohndoe / most-changed.sh
Created March 7, 2023 15:52
Files in the Git history which change most often. https://engineering.ramp.com/what-matters-suffers
View most-changed.sh
git log --name-only --pretty=format: | sort | uniq -c | sort -nr | head -n 30
@johnjohndoe
johnjohndoe / vcard-split.py
Last active February 15, 2023 10:12 — forked from umrashrf/vcard-split.py
Python script to split Google contacts into individual VCF files.
View vcard-split.py
#!/usr/bin/python
#split vcf files
import re
working_dir = '/home/umair/Documents/Contacts/'
input_file = 'contacts starred 26-06-2014.vcf'
output_seed = 'contacts-part-'
vcards_per_file = 1
@johnjohndoe
johnjohndoe / download-url-to-file.rb
Last active December 5, 2022 16:58
Ruby script to download a number of files from individual URLs via HTTP/HTTPS/FTP specified in an external file.
View download-url-to-file.rb
#!/usr/bin/env ruby
#
# Ruby script to download a number of files
# from individual URLs via HTTP/HTTPS/FTP
# specified in an external file.
#
# Author: Tobias Preuss
# Revision: 2013-04-18 16:26 +0100 UTC
# License: Creative Commons Attribution-ShareAlike 3.0 Unported
@johnjohndoe
johnjohndoe / pre-commit.sh
Created November 6, 2012 11:48
Git pre-commit hook to add a new line at the end of a file and remove trailing whitespaces
View pre-commit.sh
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Usage:
# Remove the .sh file extension when you put the script in your hooks folder!
#
@johnjohndoe
johnjohndoe / build.gradle
Created October 28, 2022 07:24
Java version used by Gradle
View build.gradle
import org.gradle.internal.jvm.Jvm
println "Gradle uses Java ${Jvm.current()}"
// example output: Gradle uses Java 17.0.4.1 (JetBrains s.r.o. 17.0.4.1+0-17.0.4.1b469.62-9127311)
@johnjohndoe
johnjohndoe / fileshuffle.py
Last active July 13, 2022 16:47
Shuffle two file names and copy the active file to a destination folder.
View fileshuffle.py
#!/bin/python3
import os
import sys
from shutil import copyfile
def getScriptPath():
"""
Returns the full directory path of this script.
"""
@johnjohndoe
johnjohndoe / EnumWithDefaultValueJsonAdapter.java
Last active March 24, 2022 08:27 — forked from NightlyNexus/EnumWithDefaultValueJsonAdapter.java
An enum JsonAdapter for Moshi that allows for a fallback value when deserializing unknown strings. NOTE: Allows null for the default. https://github.com/square/moshi/blob/master/moshi-adapters/src/main/java/com/squareup/moshi/adapters/EnumJsonAdapter.kt
View EnumWithDefaultValueJsonAdapter.java
import com.squareup.moshi.Json;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.JsonWriter;
import java.io.IOException;
public final class EnumWithDefaultValueJsonAdapter<T extends Enum<T>> extends JsonAdapter<T> {
private final Class<T> enumType;
private final String[] nameStrings;
private final T[] constants;