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
sudo nano /etc/sysctl.conf
fs.file-max=6510126
vm.overcommit_memory=1
net.core.somaxconn=65535
sudo sysctl -p
sudo nano /etc/security/limits.conf
@QuynhVir
QuynhVir / svg2icns
Created November 25, 2019 07:12 — forked from zlbruce/svg2icns
covert svg to icns (with imagemagick)
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"
@QuynhVir
QuynhVir / made-with-love.html
Created December 3, 2019 14:22 — forked from oliveratgithub/made-with-love.html
Various HTML-snippets to add "Made with love" to your website
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
<!-- Example #3 - CSS-style class for ❤ -->
<style>.heart{color:#e25555;}</style>
Made with <span class="heart">❤</span> in Switzerland
@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)

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 / 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
@QuynhVir
QuynhVir / gist:289618282a16091c0949b8d7fcd45a94
Last active March 26, 2020 09:50 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@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 / 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 }"