Skip to content

Instantly share code, notes, and snippets.

View EscVector's full-sized avatar

EscVector EscVector

View GitHub Profile
FOR /F %i IN (regions.txt) do @aws ssm get-parameters --names /aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base --query "Parameters[]" --region "%i" >> winami.json
FOR /F %i IN ('aws ec2 describe-instances --filters "Name=tag:Name,Values=tableau" --query "Reservations[*].Instances[*].{Instance:InstanceId}" --output text') DO echo start | aws ec2 start-instances --instance-ids %i
FOR /F %i IN (all_regions.txt) DO @FOR /F %q IN ('aws ec2 describe-vpcs --query "Vpcs[*].VpcId" --region %i --output text') DO @echo %i %q
FOR /L %i in (1,1,254) do ping -w 25 -n 1 10.0.0.%i | grep "Reply" >> n.txt
C:\Users\Employee\projects\aws\aws-cert\tf\security\test>tf state list
2020/09/06 15:15:35 [INFO] Terraform version: 0.13.2
2020/09/06 15:15:35 [INFO] Go runtime version: go1.14.7
2020/09/06 15:15:35 [INFO] CLI args: []string{"c:\\app\\terraform\\tf.exe", "state", "list"}
2020/09/06 15:15:35 [DEBUG] Attempting to open CLI config file: C:\Users\Employee\AppData\Roaming\terraform.rc
2020/09/06 15:15:35 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/09/06 15:15:35 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/09/06 15:15:35 [DEBUG] ignoring non-existing provider search directory C:\Users\Employee\AppData\Roaming\terraform.d\plugins
2020/09/06 15:15:35 [DEBUG] ignoring non-existing provider search directory C:\Users\Employee\AppData\Roaming\HashiCorp\Terraform\plugins
Count files in directory
find . -type f | wc -l
Diretory Size in nice format
du -h
Use all CPU to Zip
https://www.gnu.org/software/parallel/
parallel ::: 'gzip -9' ::: *
@EscVector
EscVector / gist:9d596241acea019dcf70a45c02631b83
Created April 22, 2020 20:59
Windows 10 - cygwin cmd line quick python update
REM this is for direct install onto a machine without virtenv
REM uses combo cygwin integrated and old dos commands
pip list --outdated --format=columns |tail -n +3|cut -d " " -f1 > update.txt
for /f %i in (update.txt) do pip install %i --upgrade
@EscVector
EscVector / tweepy twitter rate limits
Last active April 29, 2020 21:19
Printable list for all Tweepy Twitter API rate limit Info
ratelimits = api.rate_limit_status()
for y in ratelimits.get("resources").items():
for q in y:
if isinstance(q,dict):
for r1,r2 in q.items():
for k1,v1 in r2.items():
print(f"ratelimits['resources']['{y[0]}']['{r1}']['{k1}']")
ratelimits['resources']['lists']['/lists/list']['limit']
ratelimits['resources']['lists']['/lists/list']['remaining']
@EscVector
EscVector / return public ip
Last active April 14, 2020 14:59
Return Public IP Services
# Source https://stackoverflow.com/questions/2311510/getting-a-machines-external-ip-address-with-python
#### script ####
#Returns ip4
curl 'https://api6.ipify.org?format=json'
curl 'https://api.ipify.org?format=json'
#### Python ####
# https://docs.aws.amazon.com/cli/latest/reference/ec2/import-key-pair.html
# aws ec2 delete-key-pair --key-name "cldr"
ssh-keygen -t rsa -C "cldr" -b 4096 -f cldr -q -N ""
mv cldr cldr.pem
aws ec2 import-key-pair --key-name "cldr" --public-key-material file://cldr.pub
rem # https://docs.aws.amazon.com/cli/latest/reference/ec2/import-key-pair.html
rm cldr.pem
rm cldr.pub
@EscVector
EscVector / oci-cli-commands.txt
Last active June 3, 2020 07:42
Oci Commands
## Query syntax
## http://jmespath.org/examples.html#filters-and-multiselect-lists
#list all tenancy ACTIVE compartments [name,ocid]
oci iam compartment list --all --output table --compartment-id-in-subtree true --query "data [?\"lifecycle-state\" =='ACTIVE'].{Name:name,OCID:id}"
#list all tenancy DELETED compartments [name,ocid]
oci iam compartment list --all --output table --compartment-id-in-subtree true --query "data [?\"lifecycle-state\" =='DELETED'].{Name:name,OCID:id}"
#image list
@EscVector
EscVector / 0_prechecks.sh
Created May 12, 2019 15:28 — forked from mfernest/0_prechecks.sh
CM Path B Installation
#!/bin/sh
source ./control.sh
function no_hugepages() {
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
}
function verify_capacity() {
@EscVector
EscVector / keybase.md
Last active December 9, 2020 23:58
keybase.md

Keybase proof

I hereby claim:

  • I am escvector on github.
  • I am escvector (https://keybase.io/escvector) on keybase.
  • I have a public key ASAxw1_R3ejH9LSafgPX2zyOBipytFVysqdYhs5qX6T3hgo

To claim this, I am signing this object: