Skip to content

Instantly share code, notes, and snippets.

View greentornado's full-sized avatar

Hai Nguyen greentornado

View GitHub Profile
@greentornado
greentornado / wget_build.sh
Created February 3, 2020 11:07 — forked from matteomattei/wget_build.sh
Cross compile wget statically for ARM
#!/bin/bash
VERSION="1.17"
if [ ! -f wget-${VERSION}.tar.xz ]; then
wget http://ftp.gnu.org/gnu/wget/wget-${VERSION}.tar.xz
fi
rm -rf wget-${VERSION} build
tar xJf wget-${VERSION}.tar.xz
document.addEventListener("DOMContentLoaded", () => {
$(function(){
var datepicker = $('#result_calendar').datepicker().data('datepicker');
datepicker.update('onSelect', function(formattedDate, date, inst){
console.log(formattedDate);
});
});
});
document.addEventListener("DOMContentLoaded", () => {
$(function(){
var datepicker = $('#result_calendar').datepicker().data('datepicker');
datepicker.update('onSelect', function(formattedDate, date, inst){
console.log(formattedDate);
});
});
});
@greentornado
greentornado / aa.mpd
Last active December 30, 2019 05:44
test mpd
<?xml version="1.0" encoding="UTF-8"?><MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:full:2011" minBufferTime="PT1.5S" mediaPresentationDuration="PT229S" type="static"><Period><AdaptationSet id="0" mimeType="audio/mp4" startWithSAP="1" subsegmentAlignment="true" contentType="audio"><Representation id="140" bandwidth="128000" codecs="mp4a.40.2"><AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/><BaseURL>https://r1---sn-42u-jmge.googlevideo.com/videoplayback?expire=1577703900&amp;ei=fIUJXrjyOIuMlQTo_aWABg&amp;ip=118.70.118.219&amp;id=o-AHTwIMiyDTV8kbehKb_PBVfytZTPSGFUxfTlrIt_dWWd&amp;itag=140&amp;source=youtube&amp;requiressl=yes&amp;mm=31%2C29&amp;mn=sn-42u-jmge%2Csn-42u-nboel&amp;ms=au%2Crdu&amp;mv=m&amp;mvi=0&amp;pcm2cms=yes&amp;pl=20&amp;initcwndbps=1828750&amp;mime=audio%2Fmp4&amp;gir=yes&amp;clen=3708205&amp;dur=229.088&amp;lmt=1576512482694904&amp;mt=1577682216&amp;fvip=1&amp;keepalive=yes&amp;fexp=23842630%2C23860863&amp
@greentornado
greentornado / main.go
Created December 27, 2019 07:15
Split string lines golang
package main
import (
"fmt"
"strings"
)
const s = `
one
two
@greentornado
greentornado / md5-example.go
Created December 27, 2019 07:14 — forked from sergiotapia/md5-example.go
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@greentornado
greentornado / check.go
Created December 27, 2019 04:44 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@greentornado
greentornado / nginx.conf
Created October 22, 2019 15:34 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@greentornado
greentornado / Linux
Created September 10, 2019 03:57 — forked from tovbinm/Linux
Increase ulimit
1.
# vim /etc/sysctl.conf
fs.file-max = 999999
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.ip_local_port_range = 1024 65535
2.
# vim /etc/security/limits.conf
root - nofile 999999
package main
import (
"database/sql"
"gopkg.in/gorp.v1"
"log"
"strconv"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"