Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍✈️
looking for a co-pilot

Tua Nguyen nhtua

👨‍✈️
looking for a co-pilot
View GitHub Profile
@nhtua
nhtua / nginx-rtmp.conf
Created Dec 14, 2020
Config Nginx Rtmp
View nginx-rtmp.conf
events {}
rtmp {
server {
listen 1935;
chunk_size 4096;
application multiple {
live on;
record off;
push rtmp://a.rtmp.youtube.com/live2/<live-stream-id>;
View loadmore.js
var isClicked = false;
var btn = document.querySelector('.btn.iso-load-more');
var isInViewport = function (elem) {
var bounding = elem.getBoundingClientRect();
return (
bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
);
@nhtua
nhtua / 00.install-android-sdk.sh
Last active Oct 13, 2021
Run a Headless Android Device on Ubuntu server (no GUI)
View 00.install-android-sdk.sh
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version
@nhtua
nhtua / script.easy-reading-truyenfull.vn.js
Created Jun 25, 2018
Make truyenfull.vn easy reading
View script.easy-reading-truyenfull.vn.js
// ==UserScript==
// @name Easy read TruyenFull.Vn
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://truyenfull.vn/*/chuong-*/*
// @grant none
// ==/UserScript==
View rabbitmq-installation-guide.md
@nhtua
nhtua / SimpleHTTPServerWithUpload.py
Created Dec 14, 2017 — forked from touilleMan/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
View SimpleHTTPServerWithUpload.py
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@nhtua
nhtua / run_woff2.sh
Created Aug 7, 2015
Convert multiple fonts to woff
View run_woff2.sh
#! /bin/bash
# Put this file into woff tool's dir, which was compiled before
# To convert multiple file, type:
# ./run_woff.sh /path/to/fonts/dir <format(otf|ttf)>
fontdir=$1
fontext=$2
files=($fontdir/*.$2)
for item in ${files[*]}
do
./woff2_compress $item
@nhtua
nhtua / run_woff.sh
Created Aug 7, 2015
Convert multiple fonts to woff
View run_woff.sh
#! /bin/bash
#Put this file into woff tool's dir, which was compiled before
#To convert multiple file, type:
# ./run_woff.sh /path/to/fonts/dir <format(otf|ttf)>
fontdir=$1
fontext=$2
files=($fontdir/*.$2)
for item in ${files[*]}
do
@nhtua
nhtua / diigo.trick.js
Last active Aug 29, 2015
Make your diigo bookmarks private
View diigo.trick.js
//Run in console (press F12, click `Console` tab, paste and press Enter to run)
//NOTE:
// Scroll to end of page, choose 100 items/page.
// Run once for every page.
// After done; change page by your-self then run code again. (press Up Arrow to get pre-code)
var items = document.querySelectorAll(".editIcon");
var i = 0;
items[i].click();
var tBrowser = setInterval(function(){
@nhtua
nhtua / RandomStringGenerator.class.php
Last active Oct 21, 2016
[php] Generate ramdom string
View RandomStringGenerator.class.php
<?php
namespace Utils;
/**
* Class RandomStringGenerator
* @package Utils
*
* Solution taken from here:
* http://stackoverflow.com/a/13733588/1056679