Skip to content

Instantly share code, notes, and snippets.

View lewangdev's full-sized avatar
🐢
Running

lewang lewangdev

🐢
Running
View GitHub Profile
@lewangdev
lewangdev / README.md
Last active March 14, 2023 15:28
Change caps_lock to command+control+option+shift.(Post left_control+spacebar if press alone)

Import to Karabiner-Elements

Change caps_lock to command+control+option+shift.(Post left_control+spacebar if press alone)

Click to Import

@lewangdev
lewangdev / qiniu_sslcert.py
Last active July 6, 2023 11:26
qiniu_sslcert
#!/usr/bin/env python
## Dependencies:
#
# pip install qiniu
#
## Tips for Deploy certs to Qiniu:
#
# export DOMAIN=lewangdev.com
# export QINIU_DOMAIN=images.${DOMAIN},staticfiles.${DOMAIN}
@lewangdev
lewangdev / update-on-select.md
Last active July 8, 2022 10:08
Pattern of writing UPDATE query based on SELECT Query

Pattern:

UPDATE
    `table1` AS `dest`,
    (
        SELECT
            *
        FROM
 `table2`
@lewangdev
lewangdev / SimpleHTTPServerWithUpload.py
Created November 17, 2021 09:17 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@lewangdev
lewangdev / subnet
Last active December 14, 2020 03:09
subnet calculator
#!/usr/bin/env python3
import ipaddress
import sys
def get_cidr_ip_info(ip_net):
try:
net = ipaddress.ip_network(ip_net, strict=False)
print('IP版本号 | %s ' % str(net.version))
print('是否是私有地址 | %s ' % str(net.is_private))
FROM centos/s2i-base-centos7
MAINTAINER Le Wang <lewang.dev@gmail.com>
ARG PYTHON_VERSION=3.5.10
RUN yum install -y \
ncurses-libs \
zlib-devel \
mysql-devel \
@lewangdev
lewangdev / create-base-image-centos7.sh
Created September 8, 2020 10:35
Create KVM virtual machine
qemu-img create -f qcow2 /var/lib/libvirt/images/base-image-centos7.qcow2 40G
virt-install \
--virt-type kvm \
--name base-image-centos7 \
--vcpus 2 \
--ram 4096 \
--cdrom=/root/Downloads/CentOS-7-x86_64-Minimal-2003.iso \
--disk /var/lib/libvirt/images/base-image-centos7.qcow2,format=qcow2 \
--network bridge=br0 \
{
"Retries": 1,
"ServeNodes": [
"dns://127.0.0.1:15353?dns=https-chain://1.1.1.1/dns-query",
"red://:1081"
],
"ChainNodes": [
"https://user:pass@ip:port?peer=/etc/qiangguo/gost/peer.txt"
]
@lewangdev
lewangdev / gost.json
Last active February 26, 2020 07:41
launch-gost
# Load
launchctl load -w ~/Library/LaunchAgents/gost.plist
# Unload
launchctl unload -w ~/Library/LaunchAgents/gost.plist
@lewangdev
lewangdev / nginx.conf
Created September 24, 2019 06:13 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048