Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Vir QuynhVir

🏠
Working from home
View GitHub Profile
@QuynhVir
QuynhVir / I_will_find_you_and_I_will_kill_you.sh
Last active Apr 6, 2021
Find files that are smaller than 50 bytes then delete it
View I_will_find_you_and_I_will_kill_you.sh
# 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 Apr 3, 2021 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)
View README.md

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 Feb 20, 2021
generate EdDSA keypair for JWT
View genEdDSA.sh
openssl genpkey -algorithm ed25519 -out private.pem
openssl pkey -in private.pem -pubout
@QuynhVir
QuynhVir / fix.sh
Created Jan 26, 2021
perl: warning: Setting locale failed
View fix.sh
# 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 Oct 1, 2020
Keys on Smart Card not shown in GPG Keychain
View keys.sh
# 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 Aug 27, 2020 — forked from Pulimet/AdbCommands
Adb useful commands list
View AdbCommands
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@QuynhVir
QuynhVir / filters.txt
Last active Dec 17, 2020
my own uBlock Origin filters
View filters.txt
! Remove Facebook sponsored posts
!facebook.com##div[data-pagelet^="FeedUnit"]:has(a[role^=button]:has(> span > span:matches-css(position: relative):has-text(S)))
!facebook.com##div[data-pagelet^="FeedUnit"]:has(div[role^=button]:has(> span > span:matches-css(position: relative):has-text(S)))
!facebook.com##div[data-pagelet^="FeedUnit"]:has(a[aria-label="Sponsored"])
facebook.com##div[role="feed"] div > span > span > a > span:upward(div[role="feed"] > div)
! Remove Facebook "Suggested for You"
!facebook.com##div[data-pagelet^="FeedUnit"]:has(div[role="article"]:has(span > span > span:has-text(Suggested for You)))
! Remove Facebook "New Message"
facebook.com##span:has(div[aria-label="New Message"])
! Remove Facebook "Create Room"
@QuynhVir
QuynhVir / README.md
Created May 24, 2020
How to detect if network is dropping UDP packets?
View README.md

On serverside use

iperf3 --server

On client side use

iperf3 --udp --client <server address>

View gist:3923e3aaddb3767928bc972d892b8ab5
ffmpeg -i in.mp4 -vcodec h264_videotoolbox -b:v 5000k out.mp4
ffmpeg -i in.mp4 -vcodec hevc_videotoolbox -b:v 5000k out.mp4
@QuynhVir
QuynhVir / clearLog.cmd
Created Mar 31, 2020
Clear Windows Event Logs via CMD
View clearLog.cmd
powershell.exe -Command "Get-WinEvent -ListLog * -Force | % { Wevtutil.exe cl $_.LogName }"