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/env python | |
import sys, yaml, json | |
def funcparse(loader, node): | |
node.value = { | |
yaml.constructor.ScalarNode: loader.construct_scalar, | |
yaml.constructor.SequenceNode: loader.construct_sequence, | |
yaml.constructor.MappingNode: loader.construct_mapping, | |
}[type(node)](node) | |
node.tag = node.tag.replace(u'!Ref', 'Ref').replace(u'!', u'Fn::') |
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/env python | |
## Converting a CloudFormation Template from JSON to YAML | |
## Script copyright: http://blog.flux7.com/how-to-convert-a-cloudformation-template-from-json-to-yaml | |
## | |
## Example: | |
## $ python converter.py --json my-stack.template --yaml my-stack.yaml | |
import yaml | |
import json |
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/env python | |
# | |
# Python Version: 2.7 | |
# Boto Version 2.38 | |
# | |
# Remove those pesky default VPCs | |
# | |
# Warning: Deleting the default VPC is a permanent action. | |
# You must contact AWS Support if you want to create a new default VPC. | |
# |
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
# 1. Find the latest ID of the AMI: | |
NEW_AMI_ID=$(aws ec2 describe-images \ | |
--filters Name=name,Values=*WHATEVER AMI NAME YOU ARE LOOKING FOR* \ | |
--query 'Images[*].[ImageId,CreationDate]' \ | |
--output text | sort -k2 -r | head -n1 | awk {'print $1'}) | |
# 2. Modify a PARAMETERS.vars.json that is being used by AWS CLI in step 3.: | |
tmp=$(mktemp) | |
jq -r '[ .[] | select(.ParameterKey=="AmiId").ParameterValue |= '\"$NEW_AMI_ID\"' ]' \ | |
PARAMETERS.vars.json > "$tmp" && mv "$tmp" PARAMETERS.vars.json |
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
#!/bin/bash | |
bookid=$(find . -maxdepth 1 -regextype sed -regex ".*/[0-9]\+" | tr -d './') | |
echo "Fix the font's URL of ${bookid}..." | |
sed -i -e 's#\/getfile#http:\/\/my.safaribooksonline.com\/getfile#g' publisher-style.css | |
echo "Download the fonts for ${bookid}..." | |
mkdir -p fonts | |
mkdir -p css |
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
#!/bin/bash | |
# UNRAR 5.00 freeware https://www.rarlab.com/rar/unrar-5.0-RHEL5x64.tar.gz | |
find . -name '*.rar' -type f -execdir unrar e -o- {} \; |
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
def insertion_sort(list): | |
""" | |
Insertion sort algorithm by @luckylittle | |
""" | |
for i in range(1, len(list)): | |
current = list[i] | |
while (i > 0) and (list[i-1] > current): | |
list[i] = list[i - 1] | |
i -= 1 |
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=IRSSI service | |
[Service] | |
RemainAfterExit=yes | |
ExecStart=/usr/bin/screen -S irssi -dm irssi | |
ExecStop=/usr/bin/screen -S irssi -X quit | |
User=lmaly | |
[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
ServerName "ProFTPD server" | |
ServerIdent on "FTP Server ready." | |
ServerAdmin root@localhost | |
DefaultServer on | |
DefaultRoot ~/Downloads | |
PassivePorts 49181 49189 | |
Port 54320 | |
DefaultAddress 0.0.0.0 | |
AuthPAMConfig proftpd | |
AuthOrder mod_auth_pam.c* mod_auth_unix.c |
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
echo '" Disable automatic comment insertion\nautocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o' | sudo tee --append /etc/vimrc |
OlderNewer