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 / exportSpreadsheet.gs
Created April 1, 2020 08:04 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@e-tang
e-tang / nginxproxy.md
Created December 26, 2019 01:19 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@e-tang
e-tang / Dockerfile
Created May 18, 2019 11:12 — forked from michaelneu/Dockerfile
docker-compose configuration for PHP with NGINX and MySQL, including sendmail, MailDev and phpmyadmin
# see https://github.com/cmaessen/docker-php-sendmail for more information
FROM php:5-fpm
RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install mysql mysqli sysvsem
RUN pecl install xdebug-2.5.5 \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \