Skip to content

Instantly share code, notes, and snippets.

View tvhung83's full-sized avatar

Hung V. Nguyen tvhung83

View GitHub Profile
@tvhung83
tvhung83 / Vagrantfile
Last active January 10, 2016 15:18
Vagrantfile ubuntu/trusty64 with Oracle JDK7 and apache tomcat7
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.synced_folder "./webapps", "/var/lib/tomcat7/webapps", id: "tomcat-webapps",
owner: "tomcat7",
@tvhung83
tvhung83 / trua-nay-an-gi.sh
Created February 3, 2016 07:52
Trưa nay ăn gì
#!/bin/sh
DISHES=(
'Phở'
'Huế'
'Siêu thị'
'Bún chả'
'Bò Nia'
)
rand=$[ $RANDOM % ${#DISHES[@]} ]
@tvhung83
tvhung83 / start.sh
Created April 15, 2017 11:16
Expanded `start.sh` to install `mi-wrt` firmware
#!/bin/bash
################################################################
# Пожалуйста прочитайте следующее:
# Скрипт разработан специально для 4PDA от Foreman (http://freize.org)
# Распространение без ведома автора запрещено!
### ЗАДАЮТСЯ В СКРИПТЕ ###
# $PROMETHEUS - Шапка;
# $PROMETHEUS2 - Версия скрипта;
# $PROMETHEUS3 - Версия патча;
# $stable - Стабильный или тестовый;
;;; init.el -*- lexical-binding: t; -*-
;;
;; Author: Henrik Lissner <henrik@lissner.net>
;; URL: https://github.com/hlissner/.emacs.d
;;
;; ================= =============== =============== ======== ========
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
var express = require('express');
var Promise = require('bluebird');
var rp = require('request-promise');
var cheerio = require('cheerio');
var bodyParser = require('body-parser');
var _0x77e0=["\x55","\x57","\x4A","\x48","\x44","\x47","\x4D","\x41","\x59","\x49","\x58","\x4E","\x52","\x4C","\x42","\x50","\x4B","\x30","\x31","\x32","\x33","\x34","\x35","\x36","\x37","\x38","\x39","\x63","\x75","\x66","\x72","\x6C\x65\x6E\x67\x74\x68","\x67","\x72\x65\x70\x6C\x61\x63\x65"];function decode_download_url(_0x3f16x2,_0x3f16x3,_0x3f16x4,_0x3f16x5){var _0x3f16x6=[_0x77e0[0],_0x77e0[1],_0x77e0[2],_0x77e0[3],_0x77e0[4],_0x77e0[5],_0x77e0[6],_0x77e0[7],_0x77e0[8],_0x77e0[9],_0x77e0[10],_0x77e0[11],_0x77e0[12],_0x77e0[13],_0x77e0[14],_0x77e0[15],_0x77e0[16]];var _0x3f16x7=[_0x77e0[17],_0x77e0[18],_0x77e0[19],_0x77e0[20],_0x77e0[21],_0x77e0[22],_0x77e0[23],_0x77e0[24],_0x77e0[25],_0x77e0[26],_0x77e0[27],_0x77e0[28],_0x77e0[29],_0x77e0[30],_0x77e0[18],_0x77e0[18],_0x77e0[19]];if(_0x3f16x5> 0){for(var _0x3f16x8=0;_0x3f16x8<
@tvhung83
tvhung83 / index.js
Last active September 6, 2017 08:13
var express = require('express');
var Promise = require('bluebird');
var rp = require('request-promise');
var cheerio = require('cheerio');
var bodyParser = require('body-parser');
var _0x77e0=["\x55","\x57","\x4A","\x48","\x44","\x47","\x4D","\x41","\x59","\x49","\x58","\x4E","\x52","\x4C","\x42","\x50","\x4B","\x30","\x31","\x32","\x33","\x34","\x35","\x36","\x37","\x38","\x39","\x63","\x75","\x66","\x72","\x6C\x65\x6E\x67\x74\x68","\x67","\x72\x65\x70\x6C\x61\x63\x65"];function decode_download_url(_0x3f16x2,_0x3f16x3,_0x3f16x4,_0x3f16x5){var _0x3f16x6=[_0x77e0[0],_0x77e0[1],_0x77e0[2],_0x77e0[3],_0x77e0[4],_0x77e0[5],_0x77e0[6],_0x77e0[7],_0x77e0[8],_0x77e0[9],_0x77e0[10],_0x77e0[11],_0x77e0[12],_0x77e0[13],_0x77e0[14],_0x77e0[15],_0x77e0[16]];var _0x3f16x7=[_0x77e0[17],_0x77e0[18],_0x77e0[19],_0x77e0[20],_0x77e0[21],_0x77e0[22],_0x77e0[23],_0x77e0[24],_0x77e0[25],_0x77e0[26],_0x77e0[27],_0x77e0[28],_0x77e0[29],_0x77e0[30],_0x77e0[18],_0x77e0[18],_0x77e0[19]];if(_0x3f16x5> 0){for(var _0x3f16x8=0;_0x3f16x8<
@tvhung83
tvhung83 / gist:e44ad67b8a350167f7dbd280f9277c53
Created January 14, 2017 07:49
Lakka - Connect Xiaomi Bluetooth Controller
bluetoothctl
power on
agent on
default-agent
pairable on
discoverable on
scan on
connect <MAC>
@tvhung83
tvhung83 / BatchCellUpdater.java
Created September 13, 2017 15:06
Google Spreadsheet API v3: How to re-produce 'java.io.IOException: Error writing to server'
import com.google.gdata.client.spreadsheet.FeedURLFactory;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.Link;
import com.google.gdata.data.batch.BatchOperationType;
import com.google.gdata.data.batch.BatchStatus;
import com.google.gdata.data.batch.BatchUtils;
import com.google.gdata.data.spreadsheet.CellEntry;
import com.google.gdata.data.spreadsheet.CellFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
@tvhung83
tvhung83 / Java Timezones
Created June 13, 2018 03:45
Supported timezones by Java 8
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@tvhung83
tvhung83 / main.cpp
Created August 29, 2018 05:25
C++ REST + Postgres
//
// Created by Robert Nguyen on 10/28/17.
//
#include <algorithm>
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/endpoint.h>
#include <pistache/serializer/rapidjson.h>