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
View katacoda.md
View export_aws_cidr.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region |contains("cn-")) | .ip_prefix' |
View elasticcache_d100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./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 | |
View launch.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vue create PROJECT_NAME | |
# select features you need | |
cd PROJECT_NAME | |
vue add vue-next | |
rm src/shims-tsx.d.ts | |
sed -i '' 's/RouteConfig/RouteRecordRaw/g' src/router/index.ts # https://github.com/vuejs/vue-router-next/commit/fd49bbd085e9df7804994ea188f94384ac22e048 | |
patch -p1 <<'EOF' | |
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue | |
index dc773ba..01a7286 100644 | |
--- a/src/components/HelloWorld.vue |
View install_openjdk8.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > /etc/apt/sources.list.d/openjdk.list <<"EOF" | |
deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main | |
EOF | |
apt-get update | |
apt install -t jessie-backports openjdk-8-jdk | |
update-alternatives --config java # select java1.8 |
View bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit: https://stackoverflow.com/a/59440771/398634 | |
TZ=UTC git --no-pager show \ | |
--quiet \ | |
--abbrev=12 \ | |
--date='format-local:%Y%m%d%H%M%S' \ | |
--format="%cd-%h" |
View main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
Golang SSHAgent Usage | |
https://orebibou.com/2019/03/golang%E3%81%A7ssh-agent%E3%81%8B%E3%82%89%E9%8D%B5%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6ssh%E6%8E%A5%E7%B6%9A%E3%81%99%E3%82%8B/ | |
*/ | |
import ( | |
"fmt" | |
"golang.org/x/crypto/ssh" |
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.
View ssh_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"context" | |
"golang.org/x/crypto/ssh" | |
"golang.org/x/crypto/ssh/agent" | |
"io/ioutil" | |
"net" | |
"os" |
View calc.y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
package main | |
import( | |
"fmt" | |
"bufio" | |
"os" | |
"strconv" | |
"unicode" | |
"unicode/utf8" | |
) |
NewerOlder