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 / filters.txt
Last active March 26, 2022 18:00
my own uBlock Origin filters
! 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 16:33
How to detect if network is dropping UDP packets?

On serverside use

iperf3 --server

On client side use

iperf3 --udp --client

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 March 31, 2020 03:06
Clear Windows Event Logs via CMD
powershell.exe -Command "Get-WinEvent -ListLog * -Force | % { Wevtutil.exe cl $_.LogName }"
@QuynhVir
QuynhVir / ffmpeg.md
Last active April 30, 2021 05:40
FFmpeg cheat sheet

Basic conversion

ffmpeg -i in.mp4 out.avi

Merging video and audio, without re-encoding

ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a copy output.mp4
@QuynhVir
QuynhVir / gzip.py
Created March 27, 2020 02:50
Gzip requests
import zlib
import requests
headers = {
"accept-encoding" : "gzip",
"content-type" : "gzip",
}
post_data = "This is expected to be sent back as part of response body."
@QuynhVir
QuynhVir / policy.json
Created February 20, 2020 10:05
restrict SMTP credentials to specific sender in Amazon SES
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendRawEmail"
],
"Condition": {
"StringEquals": {
"ses:FromAddress": "do-not-reply@example.com"
@QuynhVir
QuynhVir / gpg.sh
Last active February 28, 2020 08:07
Encrypt & decrypt file with GPG
gpg -er quynh@vir.vn z.jpg
gpg -o z.jpg -d z.jpg.gpg

Keybase proof

I hereby claim:

  • I am QuynhVir on github.
  • I am quynhvir (https://keybase.io/quynhvir) on keybase.
  • I have a public key whose fingerprint is 12C3 F146 FF8D CB6A EFC1 BD44 5748 4E09 554E 8E97

To claim this, I am signing this object:

@QuynhVir
QuynhVir / remove_numberInt.py
Last active December 8, 2019 06:13
Remove object '$numberInt' from MongoDB BSON
def remove_numberInt(d):
for k, v in d.items():
if k == '$numberInt':
d = int(v)
if isinstance(v, dict):
d[k] = remove_numberInt(v)
if isinstance(v, list):
for i, item in enumerate(v):
if isinstance(item, dict):
d[k][i] = remove_numberInt(item)