Skip to content

Instantly share code, notes, and snippets.

View FelixWeichselgartner's full-sized avatar

Felix Weichselgartner FelixWeichselgartner

View GitHub Profile
@FelixWeichselgartner
FelixWeichselgartner / convert.py
Created February 1, 2023 14:02
convert broken latin1 to utf8 wordpress sql table backups
with open('exp-my-database-utf8.sql', 'r', encoding='utf8') as s:
input = s.read()
output = ''
split_char = 't'
split = input.split(split_char)
corrected = 0
not_corrected = 0
@FelixWeichselgartner
FelixWeichselgartner / simple_opencv_test.py
Last active February 4, 2022 18:37
very simple opencv camera test
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
#cap.set(3, 1920)
#cap.set(4, 1080)
while(True):
ret, frame = cap.read()
cv2.imshow('frame', frame)
@FelixWeichselgartner
FelixWeichselgartner / convert_mp42gif.sh
Created June 11, 2021 07:51
This script will convert all videos (mp4) in the folder to GIFs.
# This script will convert all videos (mp4) in the folder to GIFs.
FILES="./*.mp4"
for f in $FILES
do
echo "Processing $f file..."
ffmpeg -i $f -vf "fps=10,scale=600:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "${f}.gif"
done
@FelixWeichselgartner
FelixWeichselgartner / remove_password.bash
Created June 1, 2021 09:30
Remove all pdf passwords from files in one folder with the same password.
# This script will remove all pdf passwords from files in one folder. They have to have the same password.
FILES="./*.pdf"
for f in $FILES
do
echo "Processing $f file..."
pdftk $f input_pw ENTER_YOUR_PASSWORD output "${f}_wp.pdf"
done
@FelixWeichselgartner
FelixWeichselgartner / goldener_schnitt_fibonacci.py
Created January 4, 2021 13:13
Python script to approximate the golden ratio with the fibonacci series
import matplotlib.pyplot as plt
import numpy as np
from decimal import *
getcontext().prec = 20
MAX_ITERATIONS = 20
phi_approximations = list()
current_fib = Decimal(1)