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
| #!/usr/bin/env python | |
| # | |
| # EC2Instance must have an IAM role assign to it which has access to Route53 services | |
| # in this script the role is called 'route53role' | |
| # | |
| from boto import utils, ec2, route53 | |
| instance_metadata = utils.get_instance_metadata(timeout=0.5, num_retries=1) |
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
| # redirect port < 1024 to other ports so that server process can run as non-root | |
| # localhost/loopback | |
| sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 443 -j REDIRECT --to-ports 8443 | |
| # external | |
| sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443 |
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
| centos6 is a directory of a VirtualBox VM, size 8689088000 | |
| command for compression | |
| time tar --use-compress-program=pbzip2|lzop -cf centos6_oracle11r2.tar.xxx centos6 | |
| time lzrtar centos6 | |
| command for decompresison | |
| time pbzip2|bzip2|lzop -cd centos6_oracle11r2.tar.xxx | tar tvf - | |
| time lrzip -o - -d centos6.tar.lrz | tar tvf - |
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/bash | |
| export AWS_ACCESS_KEY_ID= | |
| export AWS_SECRET_ACCESS_KEY= | |
| export AWS_DEFAULT_REGION=ap-southeast1 | |
| if [ "$1" = "start" ]; then | |
| CMD=start-instances | |
| else | |
| CMD=stop-instances |
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
| # openshift installer by default uses a self-signed certificate for ingress controller | |
| # in order to use the ingress we need to extract the certificate and add it to local | |
| # trusted cert store to avoid warnings | |
| oc get secret router-certs-default -n openshift-ingress -o json > secret.json | |
| jq -r '.data."tls.key"' secret.json | base64 -d > private_key.pem | |
| jq -r '.data."tls.crt"' secret.json | base64 -d > cert.pem | |
| #the cert.pem file contains 2 certificate. the 1st one is used by the ingress controller, 2nd one is signer. |
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
| docker container prune --filter "until=8h" -f | |
| docker network prune --filter "until=8h" -f | |
| docker image prune --filter "until=8h" -f -a | |
| # docker system prune |
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
| drop table if exists dummy_data; | |
| create table dummy_data (index int, delay decimal, account_name varchar); | |
| insert into dummy_data | |
| values | |
| (1, 0.01, 'ACCOUNT1'), | |
| (2, 0.1, 'ACCOUNT2'), | |
| (3, 0.5, 'ACCOUNT3'), | |
| (4, 1, 'ACCOUNT4'), |
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 qrcodeT | |
| import pyotp | |
| import time | |
| def totp_url(secret, issuer, user): | |
| return f"otpauth://totp/{issuer + ':' + user}?secret={secret}&issuer={issuer}&algorithm=SHA1&digits=6&period=30" | |
| secret = pyotp.random_base32() |
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
| #! /usr/bin/python3 | |
| # sudo apt install -y python3-smbus | |
| import smbus | |
| import time | |
| # Config Register (R/W) | |
| _REG_CONFIG = 0x00 | |
| # SHUNT VOLTAGE REGISTER (R) |
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/bash | |
| balk() { | |
| echo $1 | |
| echo key2secret.sh "<private_key> <namespace> <secret_name> <ssh_host>" | |
| exit 1 | |
| } | |
| if [ "$1" = "" ]; then | |
| balk "please specify private key" |
OlderNewer