Skip to content

Instantly share code, notes, and snippets.

@taosx
taosx / gist:07de1e5b1134e9d572294914b004f7a2
Created March 13, 2018 22:44
Keywords of techniques, algorithms that may be helpful.
Debouncing
@taosx
taosx / mysql_wait.sh
Created June 8, 2017 13:45
Wait for mysql connection
#https://stackoverflow.com/a/37300565
until nc -z -v -w30 $MYSQL_HOST 3306
do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 5
done
--with-file-aio \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
@taosx
taosx / wpcli-su.sh
Created May 17, 2017 23:39
This is a wrapper so that wp-cli can run as the www-data user so that permissions
#!/bin/sh
# This is a wrapper so that wp-cli can run as the www-data user so that permissions
# remain correct
sudo -E -u ${USER} /usr/local/bin/wp-cli.phar $*
@taosx
taosx / enqueue.rb
Created March 27, 2017 20:50 — forked from hiroakis/enqueue.rb
queue implementation using MySQL
require 'mysql2-cs-bind'
def get_db
return Mysql2::Client.new(
:host => 'localhost',
:port => 3306,
:username => 'root',
:password => '',
:database => 'queue_test',
:reconnect => true,
@taosx
taosx / Nginx.conf
Created January 23, 2017 07:03
My configuration for nginx-php7-phpfpm and wordpress
# The user account used by the worker processes. If following along with Hosting WordPress Yourself,
# it's recommened to set this to your username, but only when running a single user access server.
user nginx;
# Set to number of CPU cores, auto will try to autodetect.
worker_processes auto;
# Maximum open file descriptors per process. Should be greater than worker_connections.
worker_rlimit_nofile 8192;
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
)
// Compile go with musl on archlinux
// replace musl-gcc with gcc or gcc-multilib if you don't want to compile for alpine linux
CC=$(which musl-gcc) go build --ldflags '-w -linkmode external -extldflags "-static"' main.go
@taosx
taosx / README.md
Created October 25, 2016 00:16 — forked from FND/README.md
Falcon WSGI application with asyncio

Getting Started

$ pip install falcon
$ python3 app.py

alternatively with Gunicorn (for HTTP/1.1):

$ pip install gunicorn

$ gunicorn app:app

@taosx
taosx / index.md
Created September 23, 2016 03:18 — forked from alekseykulikov/index.md
SUIT CSS naming convention for React.js application

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 6561 lines of CSS (and just 5 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers: