Navigation Menu

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 / supervisor
Created November 20, 2018 13:54 — forked from danielrmeyer/supervisor
supervisor config to keep a python script running in home directory.
[program:test]
command=/usr/bin/python /home/ubuntu/test.py
directory=/home/ubuntu
autostart=true
autorestart=true
startretries=3
stderr_logfile=/home/ubuntu/test.err.log
stdout_logfile=/home/ubuntu/test.out.log
user=ubuntu
@QuynhVir
QuynhVir / filter.sh
Created January 8, 2019 08:47
Xóa tất cả dòng chứa trong file2 khỏi file1 và lưu thành file3
comm -2 -3 <(sort file1.txt) <(sort file2.txt) > file3.txt
@QuynhVir
QuynhVir / gist:9a9357b69fd55d862622fe876348e18b
Created January 8, 2019 09:21
Increase heap size Nodejs (globally)
export NODE_OPTIONS=--max_old_space_size=4096
@QuynhVir
QuynhVir / gist:1475286d619bdcb5052c81990f97d16d
Created January 8, 2019 10:07
Disable the creation of fucking .DS_Store files
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@QuynhVir
QuynhVir / limit3.py
Last active January 9, 2019 06:22
multithreading and queue
from queue import Queue
from threading import Thread
def do_job(q):
while True:
print (q.get())
q.task_done()
q = Queue()
@QuynhVir
QuynhVir / con.go
Created January 17, 2019 15:10
Limit number of goroutines running
package main
import "fmt"
const MAX = 20
func main() {
sem := make(chan int, MAX)
for {
sem <- 1 // will block if there is MAX ints in sem
@QuynhVir
QuynhVir / ReadFile.go
Created January 17, 2019 16:06 — forked from thedevsaddam/ReadFile.go
Reading file, line by line in Go lang using scanner
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
@QuynhVir
QuynhVir / main.go
Created January 17, 2019 18:34
Facebook Graph API and Go http request example
package main
import (
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
)
type Page struct {
@QuynhVir
QuynhVir / rc.local
Created October 8, 2019 09:03
Disable fucking Transparent Huge Pages in /etc/rc.local
#!/bin/bash
/bin/echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
exit 0
@QuynhVir
QuynhVir / environment
Created October 18, 2019 14:18
setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
nano /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8