Skip to content

Instantly share code, notes, and snippets.

View nilesuan's full-sized avatar

Nile Suan nilesuan

View GitHub Profile
@nilesuan
nilesuan / .zshrc
Last active February 9, 2023 05:36
ZSHRC
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="lambda"
CASE_SENSITIVE="true"
zstyle ':omz:update' mode auto # update automatically without asking
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
@nilesuan
nilesuan / config
Last active June 2, 2022 03:33 — forked from justinpawela/config
AWS CodeCommit Multiple Account Config
Host wopr.test
HostName wopr.test
User nsuan
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
Host wopr
HostName wopr
User nsuan
UseKeychain yes
@nilesuan
nilesuan / gist:f2a0a0b1f364ba84769790ac1f40d253
Created May 16, 2017 06:34
AWS API Gateway Body Mapping Template
#set($allParams = $input.params())
{
"body-json" : $input.json('$'),
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
"$paramName" : "$util.escapeJavaScript($params.get($paramName))"
#if($foreach.hasNext),#end
@nilesuan
nilesuan / inarray.js
Created February 2, 2017 23:32
Simple in_array for javascript
var inarray = function(needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
};
exports.handler = (event, context, callback) => {
var output = {};
event.forEach(function(obj) { output = mergeJSON(output, obj); });
context.succeed(output);
};
var jsonC = {}.constructor;
var isJSON = function(json) {
if (json && json.constructor === jsonC) {