Skip to content

Instantly share code, notes, and snippets.

@onlinemad
onlinemad / nginx.your.domain.conf
Created January 10, 2022 05:58
Nginx site conf for getting Grade A+ on Qualys SSL Server Test
# Nginx site conf for getting Grade A+ on Qualys SSL Server Test
#
# Target environment
# Nginx: 1.10.1
# OpenSSL: 1.0.1t
#
# moz://a SSL Configuration Generator
# https://ssl-config.mozilla.org/
# Qualys SSL Server Test

Keybase proof

I hereby claim:

  • I am onlinemad on github.
  • I am onlinemad (https://keybase.io/onlinemad) on keybase.
  • I have a public key ASAs2Y_08pvZkuOLQigJC7FHvScRq8epFYfNYo_rXXivwwo

To claim this, I am signing this object:

function geocoding(lat, lng) {
// Gets the address of a point in Times Square.
Utilities.sleep(1000);
var response = Maps.newGeocoder().setLanguage('zh_TW').reverseGeocode(lat, lng);
var r = response.results[0];
for (var j = 0; j < r.address_components.length; j++) {
var comp = r.address_components[j];;
if (comp.types[0] === 'administrative_area_level_1') {
return comp.long_name;
}
# Path to your oh-my-zsh installation.
export ZSH=/root/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="michelebologna"
# Uncomment the following line to use case-sensitive completion.
@onlinemad
onlinemad / user.zshrc
Last active March 6, 2023 20:33
Set LC_ALL, LANG
# Path to your oh-my-zsh installation.
export ZSH=/Users/onlinemad/.oh-my-zsh
export LC_ALL=zh_TW.UTF8
export LANG=zh_TW.UTF8
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
@onlinemad
onlinemad / gist:28341a343ecde186a410
Created December 11, 2014 06:54
Get Google JWT token.
var fs = require('fs');
var jwt = require('jsonwebtoken');
var request = require('request');
// constants
var GOOGLE_OAUTH2_URL = 'https://accounts.google.com/o/oauth2/token';
var iat = Math.floor(Date.now() / 1000);
var exp = iat + 60 * 60;
var payload = {
@onlinemad
onlinemad / gcs.js
Created April 15, 2014 13:59
Sample of upload file to Google Cloud Stoage.
/**
* Sample of upload file to Google Cloud Stoage.
*
* 1. Setup a bucket and grant write permission for All Users on Google Cloud Stoage.
*
* 2. Install dependency 'request'
*
* 3. Set 'filename' and 'bucket'
*
* 4. Run!!
@onlinemad
onlinemad / init.js
Last active December 21, 2015 22:18
Init a new project based on bootstrap3-jade-node-express-grunt (https://github.com/ALT-F1/bootstrap3-jade-node-express-grunt)
#!/usr/bin/env node
var https = require('https'),
fs = require('fs'),
AdmZip = require('adm-zip'),
request = require('request'),
prompt = require('prompt'),
util = require('util'),
beautify = require('js-beautify').js_beautify;