Skip to content

Instantly share code, notes, and snippets.

View dreamlu's full-sized avatar
🤣
从前有座山,山里有座庙,庙里有个lululu~

鹿成 dreamlu

🤣
从前有座山,山里有座庙,庙里有个lululu~
View GitHub Profile
@dreamlu
dreamlu / lock.sql
Created April 23, 2023 06:56
pg 锁住/解锁
select pid, query
from pg_stat_activity
where datname = 'table'
and wait_event_type = 'Lock';
select 'select pg_cancel_backend( ''' || pid || ''');' pid
from pg_stat_activity
where datname = 'table'
and wait_event_type = 'Lock';
@dreamlu
dreamlu / batchInsert.sql
Last active July 2, 2019 08:56
批量插入百万数据,存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `database`.`name`()
BEGIN
DECLARE pre_name BIGINT;
DECLARE ageVal INT;
DECLARE i INT;
SET pre_name=862362681;
SET ageVal=100;
SET i=1;
WHILE i < 1000000 DO
INSERT shop(name,union_id, open_id) VALUES(CONCAT(pre_name,'@qq.com'),CONCAT(i ,'unionId'),CONCAT(i,'openId'));
@dreamlu
dreamlu / mysql-docker.sh
Created May 31, 2019 01:40 — 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
@dreamlu
dreamlu / win-ss
Last active April 19, 2024 05:44
windows终端翻墙,简易方式
环境:shadowsocks、windows
本地ss端口设置(这里1080)
cmd命令行:(不用socks5)(临时设置)(也可放置环境变量)
set http_proxy=http://127.0.0.1:1080
set https_proxy=http://127.0.0.1:1080
ps:一定要用cmd命令行,千万别用powershell !!!
简易测试命令:curl https://www.google.com(别用ping)
@dreamlu
dreamlu / gitconfig
Created January 22, 2019 09:34
git 免密(ssh免密除外方式)
git config --global credential.helper store
@dreamlu
dreamlu / deercoder
Last active November 15, 2018 08:35
go-path
export GOROOT=/usr/lib/go-1.10
export GOPATH=/home/lu/gowork
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin