Skip to content

Instantly share code, notes, and snippets.

View wpyoga's full-sized avatar

William Poetra Yoga wpyoga

View GitHub Profile
#!/bin/sh
lsmod | grep -qs drivetemp || sudo modprobe drivetemp
echo SATA
find /sys/devices -name vpd_pg89 | while read PG89; do
dd if=$PG89 conv=swab status=none bs=1 count=40 skip=114
echo -n ' '
dd if=$PG89 conv=swab status=none bs=1 count=20 skip=80
echo -n ' '
# /etc/apt/preferences.d/nosnap.pref
Package: snapd
Pin: release a=*
Pin-Priority: -10
@wpyoga
wpyoga / gist:5c1cefb572b1fa59af968420e0a9636f
Last active January 17, 2023 15:06
Mandiri MCM2: fix input type
// ==UserScript==
// @name Mandiri MCM2: fix input type
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Fix input types in Mandiri MCM2
// @author wpyoga
// @match https://mcm2.bankmandiri.co.id/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=mcm2.bankmandiri.co.id
// @grant none
// @run-at document-start
@wpyoga
wpyoga / gist:dd8b750d3b8eed066b9ac2461b36e88a
Last active January 17, 2023 15:05
KlikBCA: fix input type
// ==UserScript==
// @name KlikBCA: fix input type
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Fix input types in KlikBCA
// @author william.poetra@gmail.com
// @match https://ibank.klikbca.com/*.do
// @match https://ibank.klikbca.com/*.do?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=klikbca.com
// @grant none
@wpyoga
wpyoga / gist:1e30b5c0f088a91eb2610597ed66038b
Created October 3, 2022 12:19
debugging apt upgrade issues
Sometimes `apt upgrade` says "... packages have been kept back:".
To see the decision making:
```
$ sudo apt upgrade -oDebug::pkgProblemResolver=1
```
@wpyoga
wpyoga / gist:fd66478de7b5c64b57dfd122dd0d3de2
Last active January 18, 2023 09:05
useful ffmpeg switches
ffmpeg -i input.mp4 -c:v libx264 -preset veryslow -pix_fmt yuv420p -vf scale=960:540 -crf 25 -an output.mp4
# -c:v libx264
# use libx264 for encoding
# -preset veryslow
# use the veryslow preset to produce very high quality videos
# -pix_fmt yuv420p
# use yuv420p format, suitable for most videos
@wpyoga
wpyoga / gist:ad8c8cd047b1f80d7129ef217e970fcb
Created June 10, 2021 01:03
Show running processes with its command-line arguments
# Replace 'adb' with the desired process name
ps -o pid,args `pidof adb`
@wpyoga
wpyoga / gist:b984279eb717d0143e252d23adcfe535
Created May 25, 2021 07:17
ImageMagick crop then resize image
# -crop 2250x1518+0+0
# crop the image to 2250x1518
# without this, the image will be resized to
# - 800x541, if using the geometry transform
# - 799x540, if using the resize transform
#
# +repage
# reset the virtual canvas to the image size, which has been cropped
#
# -geometry 800
@wpyoga
wpyoga / gist:80581ffe82ed6d007f5c99e88e003d83
Last active February 9, 2023 14:41
FFmpeg split and concat videos
ffmpeg_concat() (
test "$#" -lt 1 && return
LISTFILE="`mktemp -p .`"
printf "file '%s'\n" "$@" > "$LISTFILE"
ffmpeg -f concat -safe 0 -i "$LISTFILE" -c copy concat.mp4
rm "$LISTFILE"
)
# to split video into multiple segments based on key frames
@wpyoga
wpyoga / gist:a35e9e0416da7ebcffd3dfd509eb2e24
Last active May 25, 2021 07:01
Convert PNG to WebP (Lossless)
# -lossless
# create a lossless image
# you can use '-z 9' to really make a small image,
# but my tests show that it only produces around 1% better compression rate,
# with much longer compression times
#
# -resize 1080 1920
# (optional) resize the image
cwebp -lossless -resize 1080 1920 image.png -o image.webp