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 / gist:95cef20536529d9d834951dc5e90d877
Created November 3, 2019 12:48
terraform-providers/terraform-provider-google issue debug log - #4804
2019/11/03 20:47:32 [INFO] Terraform version: 0.12.13
2019/11/03 20:47:32 [INFO] Go runtime version: go1.13.4
2019/11/03 20:47:32 [INFO] CLI args: []string{"/usr/local/bin/terraform", "output", "-json"}
2019/11/03 20:47:32 [DEBUG] Attempting to open CLI config file: /Users/chris_lee/.terraformrc
2019/11/03 20:47:32 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/11/03 20:47:32 [DEBUG] checking for credentials in "/Users/chris_lee/.terraform.d/plugins"
2019/11/03 20:47:32 [INFO] CLI command args: []string{"output", "-json"}
2019/11/03 20:47:32 [DEBUG] checking for provider in "."
2019/11/03 20:47:32 [DEBUG] checking for provider in "/usr/local/bin"
2019/11/03 20:47:32 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
@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 / memory_leak.php
Created May 25, 2017 04:09
php memory leak test.
<?php
class test
{
private $test = null;
public function testMethod()
{
$this->test = "abc";
$count = 0;
@chrisLeeTW
chrisLeeTW / salt-master & salt-api configuration
Created December 30, 2016 07:15
saltstack issue information : local_batch client ignore external auth
interface: 0.0.0.0
publish_port: 4505
sign_pub_messages: True
file_roots:
base:
- /srv/salt
pillar_roots:
base:
@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 / gist:c27ea060f82b2c07df74
Created September 12, 2015 07:55
Percona Xtradb Cluster IST Received Failed.
There is partial log that IST Received Failed
[CODE]
2015-09-12 15:07:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 15:07:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 15:07:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 15:07:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 15:07:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid
@chrisLeeTW
chrisLeeTW / gist:f45f56b41c19450cbb01
Created September 12, 2015 07:53
Percona Xtradb Cluster IST Received Success.
There is partial log that IST Received Success.
[CODE]
2015-09-12 13:14:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 13:14:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 13:14:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 13:14:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uuid 94043ae8 is blacklisted, skipping
2015-09-12 13:14:20 16752 [Note] WSREP: gcomm/src/gmcast.cpp:update_addresses():842: (94043ae8, 'tcp://0.0.0.0:4567') address 'tcp://10.88.3.25:4567' pointing to uu
@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