Skip to content

Instantly share code, notes, and snippets.

Hung V. Nguyen tvhung83

View GitHub Profile
View generator.js
const generate = require('csv-generate')
const fs = require('fs')
const minimist = require('minimist')
let args = minimist(process.argv.slice(2), {
alias: {
f: 'file',
c: 'columns',
l: 'length'
}
})
@tvhung83
tvhung83 / generate.go
Last active Dec 6, 2018
Generate random data to CSV file
View generate.go
package main
import (
"os"
"strconv"
"github.com/gocarina/gocsv"
"github.com/bxcodec/faker"
)
View unpack.js
exports.unpack = function (p){var c=p;var a=10,x=1;while(x<a){c=unescape(c);if(/eval\(+function\(/.test(c)){c=this.depack(c);x++}else{break}};c=unescape(c);c=R(c,{indent_size:1,indent_char:'\t'});return c}
exports.depack = depack = function (p){if(p!=""){c=unescape(p);var _e=eval,s="eval=function(v){c=v;};"+c+";eval=_e;";eval(s)}else{c=p};return c}
exports.R = R = reformat = function (a, b) {
var d, e, f, g, h, j, k, l, m;
var o, p, q, r, s, u, v;
var w, x, y, z, aa, ab;
var ac;
a = C(a);
b = b || {};
var ad = b.indent_size || 4;
@tvhung83
tvhung83 / main.cpp
Created Aug 29, 2018
C++ REST + Postgres
View main.cpp
//
// 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>
@tvhung83
tvhung83 / Java Timezones
Created Jun 13, 2018
Supported timezones by Java 8
View Java Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@tvhung83
tvhung83 / BatchCellUpdater.java
Created Sep 13, 2017
Google Spreadsheet API v3: How to re-produce 'java.io.IOException: Error writing to server'
View BatchCellUpdater.java
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;
View index.js
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<
View index.js
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<
View init.el
;;; init.el -*- lexical-binding: t; -*-
;;
;; Author: Henrik Lissner <henrik@lissner.net>
;; URL: https://github.com/hlissner/.emacs.d
;;
;; ================= =============== =============== ======== ========
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
@tvhung83
tvhung83 / start.sh
Created Apr 15, 2017
Expanded `start.sh` to install `mi-wrt` firmware
View start.sh
#!/bin/bash
################################################################
# Пожалуйста прочитайте следующее:
# Скрипт разработан специально для 4PDA от Foreman (http://freize.org)
# Распространение без ведома автора запрещено!
### ЗАДАЮТСЯ В СКРИПТЕ ###
# $PROMETHEUS - Шапка;
# $PROMETHEUS2 - Версия скрипта;
# $PROMETHEUS3 - Версия патча;
# $stable - Стабильный или тестовый;
You can’t perform that action at this time.