Skip to content

Instantly share code, notes, and snippets.

View tvhung83's full-sized avatar

Hung V. Nguyen tvhung83

View GitHub Profile
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
-- k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
@tvhung83
tvhung83 / 1pass
Last active April 27, 2020 06:47
Revised version of https://github.com/dcreemer/1pass which supports of template 102
#! /usr/bin/env bash
#
# 1pass -- a simple caching wrapper for the "op" 1Password CLI.
#
# Copyright (C) 2017 David Creemer, (twitter: @dcreemer)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-- Mike Solomon @msol 2019
local log = hs.logger.new('main', 'info')
DEVELOPING_THIS = false -- set to true to ease debugging
HYPER = {'ctrl', 'shift', 'alt', 'cmd'}
-- App bindings
function setUpAppBindings()
-- hyperFocusAll('w', 'React Native Debugger', 'Simulator', 'qemu-system-x86_64')
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 December 6, 2018 08:26
Generate random data to CSV file
package main
import (
"os"
"strconv"
"github.com/gocarina/gocsv"
"github.com/bxcodec/faker"
)
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 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>
@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 / 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 / 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<