Skip to content

Instantly share code, notes, and snippets.

@e-tang
e-tang / thinkphp.conf
Created August 11, 2023 02:09 — forked from chenhg5/thinkphp.conf
thinkphp nginx
server {
listen 80;
server_name xxxx.com;
access_log /var/log/nginx/xxxx.php-access.log backend;
error_log /var/log/nginx/xxxx.php-error.log error;
set $root /var/www/xxxx;
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
@e-tang
e-tang / mysql-docker.sh
Created December 1, 2022 00:51 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@e-tang
e-tang / matingare.py
Created April 22, 2022 07:38 — forked from tmpbook/matingare.py
马丁格尔策略模拟 1.0
#coding:utf8
import random
import math
WIN = 1
LOSE = 0
def gambling_50_percent(pocket, pay):
result = random.randint(0, 1)
if result == WIN:
@e-tang
e-tang / lets-encrypt-free-iks.md
Created October 22, 2021 03:55 — forked from jjasghar/lets-encrypt-free-iks.md
Creating Let's Encrypt certificates for IBM free Kubernetes clusters

Creating Let's Encrypt certificates for IBM free Kubernetes clusters

The IBM Kubernetes service free clusters consist of a single worker node with 2 CPU and 4 GB of memory for experimenting with Kubernetes. Unlike the fee-based service, these clusters do not include capabilities for application load balancing using ingress out-of-the-box. However, if you manage a DNS domain (any provider will suffice) and can add an A record, it's possible for you to configure your own ingress that can provide http and https session termination for your containerized applications. Getting a TLS-enabled website or simply an external REST API couldn't be easier!

Prerequisites

  • Free IBM Kubernetes Cluster (IKS) - upgrade your account from Lite plan to create one. In the example commands, we'll assume that this cluster is named mycluster
  • kubectl - match your cluster API version (as of 5/17/20 - this is ~1.16.9)
  • helm v3
  • DNS domain that you can edit to configure
@e-tang
e-tang / mac-setup-redis.md
Created November 30, 2020 02:14 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@e-tang
e-tang / Ichimoku.js
Created October 6, 2020 06:21 — forked from charlesdarkwind/Ichimoku.js
Ichimoku cloud Javascript node
const inputs = { tenkan: -9, kijun: -26, senkou: -52, chikou: -26 };
main['ichimoku_' + pair] = generateIchimoku(pair, false);
main['chikou_' + pair] = generateIchimoku(pair, true);
const generateIchimoku = (pair, isChikou) => {
const high = isChikou ? main.high[pair].slice(0, inputs.chikou) : main.high[pair];
const low = isChikou ? main.low[pair].slice(0, inputs.chikou) : main.low[pair];
@e-tang
e-tang / gist:5c53ac53afdc14b718e655663791bef8
Created July 17, 2020 07:47
The script for install MacOS (Catalina) with VirtualBox
# Ackknowledgement
# https://www.wikigain.com/install-macos-catalina-on-virtualbox-on-windows/
VBoxManage modifyvm "Catalina" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "Catalina" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "Catalina" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "Catalina" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
@e-tang
e-tang / mount-home-in-another-place
Created June 10, 2020 23:47
the /etc/fstab for mounting home and other mount points
/data/home /home none bind
/data/usr/src /usr/src none bind
@e-tang
e-tang / create-images-info
Created June 10, 2020 11:00
Create image list with size information
lynx -listonly -nonumbers -dump http://tyo.com.au/web/themes/business/ > links.txt
grep jpg links.txt > images.txt
cat images.txt
grep jpg ../business/css/style.css | cut -f 3 -d "." | while read line; do echo http://tyo.com.au/web/themes/business$line.jpg ; done > images2.txt
grep png ../business/css/style.css | cut -f 3 -d "." | while read line; do echo http://tyo.com.au/web/themes/business$line.png ; done > images3.txt
cat images3.txt
cat image*.txt > allimages.txt
cat allimages.txt
mkdir images