This file contains hidden or 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
| #reference https://medium.com/@siriphonnot/backup-and-restore-a-mysql-database-from-a-running-docker-mysql-container-6c932907e21f | |
| #reference https://medium.com/@vineetcic/script-to-take-mysql-database-backup-for-last-7-days-45f97ed067a9 | |
| mysqlUser="root" | |
| mysqlPassword="xxxxx" | |
| mysqlHost="127.0.0.1" | |
| DB="my_db" | |
| credentialsFile="/mysql-credentials.cnf" | |
| /usr/local/bin/docker-compose exec -T mysql bash -c " |
This file contains hidden or 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
| version: '3.3' | |
| services: | |
| certbot: | |
| image: certbot/certbot:v1.8.0 | |
| restart: unless-stopped | |
| volumes: | |
| - "./certbot/conf/:/etc/letsencrypt/" | |
| - "./certbot/www:/var/www/certbot/" | |
| entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" | |
| # necessary to set network_mode and dns, because certbot will connect to letsencrypt website |
This file contains hidden or 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
| export GO111MODULE=on | |
| export GOOS=linux | |
| export GOARCH=amd64 | |
| export CGO_ENABLED=1 | |
| go build -o=myapp |
This file contains hidden or 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
| <head> | |
| <meta name="ad.size" content="width=100,height=125"> | |
| <!--Ad size 100x125--> | |
| <!-- | |
| Ad manager HTML | |
| https://support.google.com/admanager/answer/7046902 | |
| --> | |
| <!-- | |
| Click tag example | |
| https://support.google.com/admanager/answer/7046799#clicktagguideline |
This file contains hidden or 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
| <# | |
| For powershell | |
| Task schedule | |
| Program: Powershell.exe | |
| Add Arguments: -ExecutionPolicy Bypass c:/path/to/script/SQLExpressBackups.ps1 | |
| If you want logging | |
| Add Arguments: -ExecutionPolicy Bypass c:/path/to/script/SQLExpressBackups.ps1 | Out-File -FilePath sql_express_backup.log | |
| #> |
This file contains hidden or 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
| import dayjs from 'dayjs' | |
| import 'dayjs/locale/th' | |
| //Format date with en locale | |
| console.log("day js DD-MM-YYYY", dayjs('2019-08-01').locale('en').format('DD-MMMM-YYYY')) | |
| // => day js DD-MM-YYYY 01-August-2019 | |
| console.log("day js DD-MM-YYYY", dayjs('2019-08-01').locale('th').add(543, 'year').format('DD MMMM YYYY')) | |
| // => day js DD-MM-YYYY 31 สิงหาคม 2562 |
This file contains hidden or 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
| const dayjs = require("dayjs") // or import dayjs from 'dayjs' | |
| console.log("Format date DD-MM-YYYY", dayjs('2019-08-01').format('DD-MM-YYYY')) | |
| // => Format date DD-MM-YYYY 01-08-2019 | |
| console.log("Format date DD-MMMM-YYYY", dayjs('2019-08-01').format('DD-MMMM-YYYY')) | |
| // => Format date DD-MMMM-YYYY 01-August-2019 | |
| console.log("Last date in August 2019", dayjs('2019-08-01').endOf('month').toDate()) | |
| // => Last date in August 2019 2019-08-31T16:59:59.999Z |
This file contains hidden or 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
| #https://rancher.com/docs/rancher/v2.x/en/troubleshooting/networking/ | |
| echo "=> Start network overlay test"; kubectl get pods -l name=overlaytest -o jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.nodeName}{"\n"}{end}' | while read spod shost; do kubectl get pods -l name=overlaytest -o jsonpath='{range .items[*]}{@.status.podIP}{" "}{@.spec.nodeName}{"\n"}{end}' | while read tip thost; do echo "source_host=>"$shost", pod=>"$spod", dest_host=>"$thost", ip=>"$tip;kubectl --request-timeout='10s' exec $spod -- /bin/sh -c "ping -c2 $tip > /dev/null 2>&1"; RC=$?; if [ $RC -ne 0 ]; then echo $shost cannot reach $thost; fi; done; done; echo "=> End network overlay test" |
This file contains hidden or 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
| #!/bin/sh | |
| docker rm -f $(docker ps -qa) | |
| docker volume rm $(docker volume ls -q) | |
| cleanupdirs=" | |
| /etc/ceph \ | |
| /run/secrets/kubernetes.io \ | |
| /run/calico \ | |
| /run/flannel \ | |
| /var/lib/calico \ | |
| /var/lib/kubelet \ |
This file contains hidden or 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
| function configFontLoader(config, options = {}) { | |
| let { isServer, name = "[name].[ext]" } = options; | |
| config.module.rules.push({ | |
| test: /\.(woff|woff2|eot|ttf|otf|svg)$/, | |
| use: [ | |
| { | |
| loader: "url-loader", | |
| options: { | |
| limit: 8192, |