Skip to content

Instantly share code, notes, and snippets.

View QuynhVir's full-sized avatar
🏠
Working from home

Vir QuynhVir

🏠
Working from home
  • Midgard
View GitHub Profile
@QuynhVir
QuynhVir / systemd_service_hardening.md
Created December 9, 2021 01:59 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@QuynhVir
QuynhVir / decrypt.js
Created October 1, 2021 03:05
retrieve Chrome cookies on Windows then decrypt
const dpapi = require("win-dpapi")
const sqlite3 = require("sqlite3")
const os = require("os")
const fs = require("fs")
const crypto = require("crypto")
const path =
os.homedir() + `\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Cookies`
db = new sqlite3.Database(path)

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@QuynhVir
QuynhVir / remove_GPS_coordinates_from_EXIF.sh
Last active July 27, 2021 17:31
Remove all GPS coordinates of *.heic files, include sub directories.
exiftool -gps:all= -r -ext heic .
@QuynhVir
QuynhVir / I_will_find_you_and_I_will_kill_you.sh
Last active April 6, 2021 11:20
Find files that are smaller than 50 bytes then delete it
# Count: find . -type f -size -50c -printf 1 | wc -c
# `b' for 512-byte blocks (this is the default if no suffix is used)
# `c' for bytes
# `w' for two-byte words
# `k' for Kilobytes (units of 1024 bytes)
# `M' for Megabytes (units of 1048576 bytes)
# `G' for Gigabytes (units of 1073741824 bytes)
find . -type f -size -50c -delete
@QuynhVir
QuynhVir / README.md
Created April 3, 2021 06:03 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@QuynhVir
QuynhVir / genEdDSA.sh
Created February 20, 2021 08:50
generate EdDSA keypair for JWT
openssl genpkey -algorithm ed25519 -out private.pem
openssl pkey -in private.pem -pubout
@QuynhVir
QuynhVir / fix.sh
Created January 26, 2021 16:41
perl: warning: Setting locale failed
# Install locales-all package
sudo apt-get install -y locales-all
# Set environment variables
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Generate en_US.UTF-8
sudo locale-gen en_US.UTF-8
@QuynhVir
QuynhVir / keys.sh
Created October 1, 2020 16:19
Keys on Smart Card not shown in GPG Keychain
# Get the public key (only if the public key is not yet in your keychain)
gpg --card-edit
fetch
quit
# Create a stub for the secret key in your keychain
gpg --card-status
# Use the (secret) key as if it was in your keychain
@QuynhVir
QuynhVir / AdbCommands
Created August 27, 2020 01:54 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader