Skip to content

Instantly share code, notes, and snippets.

@jailbirt
jailbirt / moveAwsLaunchTemplateBetweenRegions.sh
Created April 18, 2023 20:00
Move AWS Launch Templates from one region to another.
#!/bin/bash
if [ -z $1 ];then
echo please provide the launch template to copy from
exit 0
fi
aws ec2 describe-launch-template-versions --launch-template-id $1 > $1.json
echo old template was saved as $1.json modify it and create the new one by running:
echo aws ec2 create-launch-template --launch-template-name MyNewLaunchTemplateName --version-description "Initial version" --cli-input-json file://$1.json
@jailbirt
jailbirt / StopStartEc2InstanceByName.sh
Created April 18, 2023 18:38
StopStartEc2InstanceByName.sh
#!/bin/bash
# Get the name tag from command line argument
if [ $# -eq 0 ]
then
echo "Please provide a name tag for EC2 instances"
exit 1
fi
name=$1
@jailbirt
jailbirt / listTagsTasksRunning.sh
Created February 7, 2023 21:47
list all tags for ecs task-run cluster. For handling according its tags.
#!/bin/bash
tasks_arns=$(aws ecs list-tasks --cluster autoBots| jq -r '.taskArns[]')
for task in $tasks_arns
do
tags=$(aws ecs list-tags-for-resource --resource-arn $task| jq -r '.tags[]' | jq -c '{"key": .key, "value": .value}')
for tag in $tags; do
key=$(echo $tag | jq -r '.key')
value=$(echo $tag | jq -r '.value')
declare "$key=$value"
done
@jailbirt
jailbirt / gist:3b6fa52c4621718646e7252b74172970
Last active February 7, 2023 21:46
retrieveLastTweet.sh
#!/bin/bash
if ! command -v jq > /dev/null; then sudo apt-get install -y jq; fi
# How many tweets to get
COUNT=1
# Set the API endpoint and user to retrieve timeline for
API_ENDPOINT="https://api.twitter.com/1.1/statuses/user_timeline.json"
# Replace with the user
USER=""
# Replace with your own API credentials
@jailbirt
jailbirt / nordVpnConnectCountry.sh
Last active January 3, 2023 21:39
It connects to nordvpn for a given country, and leaves ssh connection working from the internet. It works pretty well with aws ec2 instances.
#!/bin/bash
# Only tested on ubuntu 22.04.
#It requires openvpn installed with its ca certificates.
#If you are running it from AWS please set up your aws ec2 instance to allow traffic from different networks.
# on your EC2 instance at the EC2 Dashboard -> Actions -> Networking -> Change source/destination check -> And allow all traffic.
## Config
#set your country [a-z][a-z]
country="ar"
#set your country name, check this at ipinfo.io
contryName="Argentina"
@jailbirt
jailbirt / theeye.io
Last active January 13, 2021 15:40
theeye.io
https://theeye.io
theeye es la única plataforma de automatización de procesos que garantiza un retorno de inversión en menos de 6 meses
Theeye is the only process automation platform that guarantees a return on investment in less than 6 months
rpa, robotics, process, automation, devopshub, latam, argentina, colombia, peru, chile, spain, espaa, us, united states, usa, europe, uk, england, brasil, mexico, ia, artificial, intelligence, machine, learning, digital, bpm, erp
@jailbirt
jailbirt / changeIPUsingNordVPN.sh
Last active November 20, 2019 22:05
For every time this script is invoqued It changes the server IP by using nordvpn. It install all the necesary packages only tested on ubuntu 18.04
#!/bin/bash
#If you are running on AWS add this route tables before running this script, otherwise you won't be able to do a ssh login.
#A good place is user-data before running the instance
#ip rule add from $(ip route get 1 | grep -Po '(?<=src )(\S+)') table 128
#ip route add table 128 to $(ip route get 1 | grep -Po '(?<=src )(\S+)')/32 dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
#ip route add table 128 default via $(ip -4 route ls | grep default | grep -Po '(?<=via )(\S+)')
user=$1
pass=$2
if whoami | grep -v root;then echo "failure run as root";exit;fi
#1 Nodejs Installation
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get -y install nodejs
sudo apt-get -y install build-essential
sudo apt-get -y install libzmq3-dev build-essential
sudo apt-get -y install python
#install nvm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
#use node v4 If you dont bitcore will fails because a recursion issue due to bitcore libs.
#1 Nodejs Installation
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get -y install nodejs
sudo apt-get -y install build-essential
sudo apt-get -y install libzmq3-dev build-essential
sudo apt-get -y install python
#install nvm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
#use node v4 If you dont bitcore will fails because a recursion issue due to bitcore libs.
@jailbirt
jailbirt / metrics.sh
Created March 6, 2017 03:05 — forked from bspaulding/metrics.sh
codebase metrics
# use noglob on zsh
# change file extensions where appropriate
# collect source file paths for analysis
find . -name "*.js" | grep -v "bower_components" | grep -v "node_modules" > source_files.txt
# number of files in project
wc -l source_files.txt
# number of lines by file