Skip to content

Instantly share code, notes, and snippets.


Dreampuf dreampuf

View GitHub Profile
dreampuf /
Created Mar 4, 2022

docker pull mysql/mysql-server:latest docker run --name=mysql1 -d -p 3306:3306 mysql/mysql-server:latest while [ "docker inspect --format='{{.State.Health.Status}}' mysql1" != "healthy" ]; do echo "Starting server..."; sleep 5; done MYSQL_PASSWORD=$(docker logs mysql1 2>&1 | grep GENERATED | cut -d ' ' -f5) docker exec -e MYSQL_PASSWORD=$MYSQL_PASSWORD mysql1 mysql --connect-expired-password -uroot -p$MYSQL_PASSWORD -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';" cat </tmp/setup.sql CREATE USER 'admin'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON * . * TO 'admin'@'%'; FLUSH PRIVILEGES; EOF

dreampuf /
Created Feb 7, 2022
Export selected AWS region IP CIDR
curl -L | jq -r '.prefixes[] | select(.region |contains("cn-")) | .ip_prefix'
dreampuf / elasticcache_d100
Last active Aug 28, 2021
Performance: AWS MemoryDB vs Elasticcache
View elasticcache_d100
$ ./memtier_benchmark -s ENDPOINT -d 100
[RUN #1] Preparing benchmark client...
[RUN #1] Launching threads now...
[RUN #1 100%, 54 secs] 0 threads: 2000000 ops, 38847 (avg: 36961) ops/sec, 1.84MB/sec (avg: 1.75MB/sec), 5.15 (avg: 5.41) msec latency
4 Threads
50 Connections per thread
10000 Requests per client
dreampuf /
Created Jul 8, 2020
How to create a vuejs3 project
vue create PROJECT_NAME
# select features you need
vue add vue-next
rm src/shims-tsx.d.ts
sed -i '' 's/RouteConfig/RouteRecordRaw/g' src/router/index.ts #
patch -p1 <<'EOF'
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
index dc773ba..01a7286 100644
--- a/src/components/HelloWorld.vue
dreampuf /
Last active Jul 2, 2020
Install JDK8 on Jessie in 2020
cat > /etc/apt/sources.list.d/openjdk.list <<"EOF"
deb [check-valid-until=no] jessie-backports main
apt-get update
apt install -t jessie-backports openjdk-8-jdk
update-alternatives --config java # select java1.8
dreampuf / bash
Last active Mar 21, 2020
How to get the golang package version of the latest git repo commit
View bash
# Credit:
TZ=UTC git --no-pager show \
--quiet \
--abbrev=12 \
--date='format-local:%Y%m%d%H%M%S' \
dreampuf / main.go
Last active Apr 27, 2022
Golang SSHAgent Usage Example
View main.go
package main
Golang SSHAgent Usage
import (
dreampuf / chicken_soup.ipynb
Last active Nov 19, 2019
Greasy Chiken Soup
View chicken_soup.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dreampuf / ssh_test.go
Created Aug 27, 2019
Golang SSH Interactively shell show case
View ssh_test.go
package main
import (
dreampuf / calc.y
Last active Aug 22, 2019
hostlist generate by goyacc
View calc.y
package main