Skip to content

Instantly share code, notes, and snippets.

View leollon's full-sized avatar
💭
I may be slow to respond.

leollon leollon

💭
I may be slow to respond.
View GitHub Profile
@leollon
leollon / config.json
Created March 2, 2023 16:11 — forked from timercrack/config.json
openwrt + XRAY 使用 iptables 实现 IPV4 / IPV6 透明代理
{//服务器使用的方案:VLESS+TLS+WS+NGINX+CDN,看情况替换成自己的
"log": {
"access": "/dev/null",
"error": "/var/log/xray_error.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag":"transparent",
"port": 12345,
@leollon
leollon / remove_file_pattern.sh
Last active June 5, 2020 04:21
remove file pattern
#/bin/bash
#
# for: remove files that satify the specified pattern
#
find -type f-iname "<pattern>" -exec rm -rf'{}' \;
@leollon
leollon / nginx.conf
Created April 6, 2020 15:32 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@leollon
leollon / modern_js.md
Created February 4, 2020 14:01 — forked from gaearon/modern_js.md
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@leollon
leollon / hexo markdown regular expression parse.txt
Last active January 10, 2020 13:38
hexo markdown regular expression
import re
pat = re.compile(
r"\-*\s*"
r"\w*:\s*([\w\d\-,.!?'\"&/<>:\ \u4e00-\u9fa5\u30a0-\u30ff\u3040-\u309f\u4e00-\u9fcf\(\)\[\]]*)\s*(?#title)"
r"\w*:\s*(\d{4}\-\d{2}\-\d{2}\ *\d{2}:\d{2}:\d{2})\s*(?#date)"
r"\w*:\s*([\w\d\-'\ \[\]/.\u4e00-\u9fa5\u30a0-\u30ff\u3040-\u309f\u4e00–\u9fcf]*)\s*(?#categories)"
r"\w*:\s*\[([\w\d\ \-.\"',/\u4e00-\u9fa5\u30a0-\u30ff\u3040-\u309f\u4e00–\u9fcf]*)\]\s*(?#tags)"
r"\-*\s?([\w\d\s\u4e00-\u9fa5\u30a0-\u30ff\u3040-\u309f\u4e00–\u9fcf#@$%^&,.:;!?\"'`。,、;:“”"
r"——!?()\+\-*/=|\\\(\)\[\]{}<>]*)(?#content)")
@leollon
leollon / get_current_network_time.sh
Last active June 5, 2020 04:22
get current network time.
#/bin/bash
wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8
# Can be used to set system time on vps server whose provider blocks external ntp packages, Having to combine with `date -s` command
# https://askubuntu.com/a/655528/935221
@leollon
leollon / colorized-output-in-shell.sh
Last active November 19, 2019 08:39
change output color of echo or printf in linux
#!/bin/bash
# Reference:
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
@leollon
leollon / python3.7-alpine.dockerfile
Last active November 14, 2019 03:12
python3.7-alpine.dockerfile for uwsgi and pillow
FROM python:3.7-alpine
RUN apk add --no-cache \
gcc linux-headers libc-dev \ # related to build uwsgi
mariadb-dev python3-dev libffi-dev openssl-dev \ # related to mysql, cffi, and ssl.
jpeg-dev zlib-dev bash # related to python package pillow
RUN rm -rf \
/usr/local/share/doc \
/usr/local/share/man \
@leollon
leollon / ffmpeg.md
Created May 8, 2019 13:47 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@leollon
leollon / gtk.css
Created March 15, 2019 08:09
slim down ubuntu gnome 3.18 title bar fatness
.header-bar.default-decoration {
padding-top: 2px;
padding-bottom: 2px;
}
.header-bar.default-decoration .button.titlebutton {
padding-top: 2px;
padding-bottom: 2px;
}
/*