Skip to content

Instantly share code, notes, and snippets.

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

pandaTerminator pandaTerminator

💭
I may be slow to respond.
View GitHub Profile
@pandaTerminator
pandaTerminator / deleteFiles.py
Created November 3, 2019 10:16
delete specific files
import os
import fnmatch
def run():
filePath = '/Users/panda/Downloads/bucket3/'
for file in os.listdir(filePath):
if fnmatch.fnmatch(file, '*(1).HEIC'):
print(file)
path = os.path.join(filePath, file)
@pandaTerminator
pandaTerminator / bucketMove.py
Created November 3, 2019 10:15
move bucket photos or video to another position
import os
def run():
path = 'originalFolder'
filePath = 'targetFolder'
ext = ['.jpg', '.JPG', '.png', '.PNG', '.mp4', '.HEIC']
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
if (filename.endswith(tuple(ext))):
src = os.path.join(dirpath, filename)
/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c\ude32-\ude3a]|[\ud83c\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g
@pandaTerminator
pandaTerminator / docker run mysql
Last active July 18, 2019 07:26
docker shell
docker run -d --rm --name=mysql -e MYSQL_ROOT_PASSWORD=Password -p 3307:3306 mysql:8.0.15 --default-authentication-plugin=mysql_native_password
@pandaTerminator
pandaTerminator / parse.js
Last active July 1, 2019 07:21
cost of parsing json
const data = {foo: 42, bar: 1337} // 🐌
const data = JSON.parse('{"foo": 42, "bar":"1337"}') // 🚀
iptables -I INPUT 1 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
@pandaTerminator
pandaTerminator / mysql-reset-passwd.txt
Last active May 10, 2018 04:15
mysql reset passwd
# vi /etc/my.cnf # [mysqld]下skip-grant-tables 内容前添加#
# mysql -uroot -p 连续输入enter 进入
# use mysql
# update mysql.user set authentication_string=PASSWORD('redhat') where User='root';
# grant all privileges on *.* to root@'%' identified by 'redhat'; (授权,不然navicat等无法登录数据库)。
# vi /etc/my.cnf # [mysqld]下skip-grant-tables 内容前去掉#
#systemctl status mysql.service 重启mysql数据库服务。