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
# Delete buckets tagged with a key | |
for bucket in `aws --profile mojintegration s3api list-buckets --query "Buckets[].Name" --output text` ; doecho -n "Bucket: [${bucket}]: " ; [ "$(aws --profile mojintegration s3api get-bucket-tagging --bucket "${bucket}" --query 'TagSet[?Key==`pm` && Value==`works`].Key' --output text 2>/dev/null)" == "pm" ] && echo -e "\033[31mdelete\033[0m" || echo -e "\033[32mkeep\033[0m" ; done | |
# Delte old logstreams from a logGroup | |
LOG_GROUP=a | |
for streamName in $(aws --profile mojintegration logs describe-log-streams --log-group-name "${LOG_GROUP}" --query 'logStreams[?lastIngestionTime <= `1502092833000`].logStreamName' --output text) ; do aws --profile mojintegration logs delete-log-stream --log-group-name "${LOG_GROUP}" --log-stream-name "${streamName}" ; done | |
# Delte log grouos which name starts with <LOG_GROUP> | |
for logGroup in $(aws --profile mojintegrations logs describe-log-groups --query "logGroups[?starts_with(logGroupName, \`${LOG_GROUP}\`)].logGroupName" --output text) ; d |
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
const fs = require('fs') | |
exports.handler = (event, context, callback) => { | |
module.paths.concat('/var/runtime/node_modules') | |
.forEach((path) => { | |
if (!fs.existsSync(path)) | |
return; | |
const d = fs.readdirSync(path); | |
console.log(path, d); |
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
import pip | |
def lambda_handler(event, context): | |
installed_packages = pip.get_installed_distributions() | |
installed_packages_list = sorted(["%s==%s" % (pkg.key, pkg.version) for pkg in installed_packages]) | |
print("\n".join(installed_packages_list)) |
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
#!/usr/bin/expect | |
set timeout 20 | |
set host [lindex $argv 0] | |
set user [lindex $argv 1] | |
set pass [lindex $argv 2] | |
set ipv6 [lindex $argv 3] | |
set chainName "Advanced" | |
spawn telnet $host |
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
[Unit] | |
Description=CloudWatch Logs agent | |
After=network.target | |
[Service] | |
Restart=always | |
TimeoutSec=infinity | |
ExecStart=/var/awslogs/bin/awslogs-agent-launcher.sh | |
[Install] |
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 ( | |
"log" | |
"strings" | |
) | |
type Session struct { | |
Email string | |
Password string |
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
Fri Nov 18 16:27:25 UTC 2016 |
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
--- | |
- name: "Always tag shoudld not run if condition fails" | |
hosts: localhost | |
gather_facts: no | |
tasks: | |
- debug: msg="This should run" | |
tags: | |
- always |
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
# How to use it | |
# copy the code into .bashrc our download the .bash_node_v file into your home | |
# and add to your .bashrc or .bash_profile: | |
# source .bash_node_v | |
# | |
# Configure it creating a .nrc (in your home or in the same folder you put this file) and add | |
# the folder where you want to install the node versions, for instance: | |
# NODE_PREFIX="/Software/node/" | |
# |
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
/** | |
* Open Amazon Cloud Drive folder and run this script to download all the files in the folder. | |
*/ | |
var items = document.getElementsByClassName('item'); | |
var i; | |
var url | |
var urls = [] | |
for(i = 0; i < items.length; ++i) { |