Skip to content

Instantly share code, notes, and snippets.

View chrisLeeTW's full-sized avatar
😊
thinking ...

ChrisLeeTW chrisLeeTW

😊
thinking ...
View GitHub Profile
@chrisLeeTW
chrisLeeTW / gist:a05402052acd9a0c8dd19358a8c282e6
Created July 27, 2020 03:11 — forked from davidlonjon/gist:5882129
JavaScript: String to Boolean
// Taken from:
// http://stackoverflow.com/questions/263965/how-can-i-convert-a-string-to-boolean-in-javascript
stringToBoolean = function(string) {
switch(string.toLowerCase()){
case "true": case "yes": case "1": return true;
case "false": case "no": case "0": case null: return false;
default: return Boolean(string);
}
}
@chrisLeeTW
chrisLeeTW / nginx.conf
Created August 26, 2017 08:58 — forked from lloydzhou/nginx.conf
nginx srcache module to server stale data, using lua-resty-lock to make one request to create new cache, and using "lua-resty-http" + "ngx.timer.at" to update new cache in background.
upstream www {
server 127.0.0.1:9999;
}
upstream redis {
server 127.0.0.1:6379;
keepalive 1024;
}
lua_shared_dict srcache_locks 100k;
server {
@chrisLeeTW
chrisLeeTW / elasticsearch-handlers-main.yml
Created August 26, 2017 08:09 — forked from labrown/elasticsearch-handlers-main.yml
Ansible rolling restart of Elasticsearch Cluster
---
###
# Elasticsearch Rolling restart using Ansible
###
##
## Why is this needed?
##
#
# Even if you use a serial setting to limit the number of nodes processed at one
@chrisLeeTW
chrisLeeTW / gpg-import-and-export-instructions.md
Last active August 30, 2016 06:19 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

gpg create a new local key

gpg --gen-key

gpg import and export instructions

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

@chrisLeeTW
chrisLeeTW / php-fpm-cli
Last active June 4, 2018 15:25 — forked from muhqu/php-fpm-cli
php-fpm-cli with status & ping function.
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell