Skip to content

Instantly share code, notes, and snippets.

@tothi
tothi / git_cheatsheet.txt
Last active August 15, 2024 20:26
git cheatsheet for basic things
# git cheatsheet: some basic git instructions (w.i.p.)
# create bare repo for an existing source tree
git init --bare project.git
cd project.git
# edit exclude
edit info/exclude
# add files to bare repo
@tothi
tothi / gcstar-win32
Last active December 18, 2020 15:39
# quick note about running GCstar (collection manager) on Win32 (x64)
[GCstar homepage](http://www.gcstar.org/index.en.php)
[project](https://gna.org/projects/gcstar) is hosted on [Gna!](https://gna.org)
current version is 1.7.1
win32 full-featured installer is available up to [1.6.1](http://download.gna.org/gcstar/win32/GCstar_1.6.1_Setup.exe)
@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' .

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 / mkpsrevshell.py
Created February 17, 2019 00:05
reverse PowerShell cmdline payload generator (base64 encoded)
#!/usr/bin/env python3
#
# generate reverse powershell cmdline with base64 encoded args
#
import sys
import base64
def help():
print("USAGE: %s IP PORT" % sys.argv[0])
@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 / android_burp.txt
Last active August 15, 2024 20:24
android emulator setup with sniffer CA
OBSOLETE: moved to Magisk + Magisk Trust User Certs module.
Emulator setup with Magisk: https://gist.github.com/tothi/1a206791c8b77d7e42015183c980657e
Magisk Trust User Certs module: https://github.com/NVISOsecurity/MagiskTrustUserCerts
android emulator clean install + prepare for https proxy analysis
=================================================================
# clean up old packages
@tothi
tothi / tunnel_vm_socks.txt
Last active August 14, 2022 10:02
tunnel virtualbox through socks (using poor man's vpn = ssh socks tunnel)
# ssh socks server on :5000 (tunnels traffic to tunnel-endpoint-server)
ssh -D5000 -NT -v user@tunnel-endpoint-server
# redsocks: https://github.com/darkk/redsocks
# 1.) as a socks client, listen on :4999 and connect to :5000
# 2.) run a dummy udp dns server on :5300 (to force vm to fallback to tcp which is working through ssh socks)
cat > redsocks.conf <<EOF
base { log_info=on; redirector=iptables; }
redsocks { local_ip=127.0.0.1; local_port=4999; ip=127.0.0.1; port=5000; type=socks4; }
dnstc { local_ip=127.0.0.1; local_port=5300; }
@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