Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tothi on github.
  • I am tothi (https://keybase.io/tothi) on keybase.
  • I have a public key whose fingerprint is 485B 0C27 A19A D1E1 302F A86F F4A7 D558 7B40 6D08

To claim this, I am signing this object:

@tothi
tothi / winrm-interactive.rb
Created February 10, 2019 20:17
interactive remote powershell (winrm) with client certificate auth
#!/usr/bin/ruby
#
# https://github.com/WinRb/WinRM
#
require 'winrm'
opts = {
endpoint: 'https://xxx.xxx.xxx.xxx:5986/wsman',
transport: :ssl,
client_cert: 'certs/MyClient.cer',
@tothi
tothi / photo_batch_rename_HOWTO.txt
Last active April 23, 2019 19:57
organize photos based on date taken and creator device
# fix time for Sony camera images
exiftool -v0 "-AllDates+=1" -overwrite_original DSC*
# exactly (diff is 1 hour -4 min):
exiftool -v0 "-AllDates+=0:56" -overwrite_original DSC*
# NOTE: cant modify MTS files ;(
# batch rename all files (except mp4) in dir based on exif date + model (dry test run)
exiftool --ext mp4 -v0 -d %Y%m%d_%H%M%S%%-c '-testname<${DateTimeOriginal}_${Model;s/[ -]//g}.%e' .
@tothi
tothi / fixts.sh
Last active May 15, 2019 08:37
fix ip camera stream timestamp recorded with ffmpeg segment option
#!/bin/bash
IFS=$'\n' ; for s in `ls stream_*.asf | head -n -1` ; do
ffmpeg -i ${s} -y -c:v copy -an -bsf:v h264_mp4toannexb ${s%.asf}.h264
ffmpeg -r 25 -y -i ${s%.asf}.h264 -c copy ${s%.asf}.mp4 && touch -r ${s} ${s%.asf}.mp4 && rm ${s%.asf}.h264 $s
done
@tothi
tothi / pdf2a4
Created August 4, 2019 11:35
convert pdf to a4 (fit-to-page) using imagemagick
# comment out <policy domain="delegate" rights="none" pattern="gs"/> from /etc/ImageMagick-7/policy.xml
convert -density 150 -define pdf:fit-page=A4 $src.pdf $dst.pdf
# adobe reader error -> use chrome to open & print (on win)
@tothi
tothi / frida-bypass-jb-check.js
Created September 15, 2019 09:06
simple jailbreak check bypass (frida hook for a custom app)
// simple jailbreak check bypass (frida hook for a custom app)
//
// launch app with frida hook:
// frida -U -l frida-bypass-jb-check.js -f ... --no-pause
var fileExistsAtPath = ObjC.classes.NSFileManager["- fileExistsAtPath:"];
var hideFile = 0;
var jailbreakFiles = ["/Applications/Cydia.app",
"/bin/bash",
@tothi
tothi / imagemagick.txt
Last active November 11, 2019 21:43
imagemagick magic
# batch convert jpg photos to a4 pdf keeping exif orientation
convert *jpg -compress jpeg -auto-orient -quality 75 -resize 1240x1754 -extent 1240x1754 -gravity center -units PixelsPerInch -density 150x150 out.pdf
# add auto-rotate to A4 portrait (e.g. for printing):
convert *jpg -compress jpeg -rotate "-90>" -quality 75 -resize 1240x1754 -extent 1240x1754 -gravity center -units PixelsPerInch -density 150x150 out.pdf
# action_0 (move files in case of '0' key is pressed):
find ~/images/ -type f -newermt "2019-12-07" ! -newermt "2019-12-15" | sort | feh -f - -F -A "mv %F ~/images_selected/%N"
#!/usr/bin/env python3
import socket
import struct
import re
import argparse
from termcolor import colored
# used for telnet switching
defaultcreds = 'admin:ipcam'
@tothi
tothi / filmhiradokonline-dl.py
Created November 2, 2020 12:35
download video files from filmhiradokline.hu
#!/usr/bin/env python3
#
# download video from https://filmhiradokonline.hu
#
import argparse
import requests
import urllib.request
import sys
from tqdm import tqdm