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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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 bash | |
# lists all unused AWS security groups. | |
# a group is considered unused if it's not attached to any network interface. | |
# requires aws-cli and jq. | |
# all groups | |
aws ec2 describe-security-groups \ | |
| jq --raw-output '.SecurityGroups[] | [.GroupName, .GroupId] | @tsv' \ | |
| sort > /tmp/sg.all |
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 bash | |
# shows uses of an AWS security group: | |
# * lists all network interfaces it is attached to. | |
# * lists all other security groups referencing it in inbound rules. | |
# usage: aws.sg my-security-group-name | |
# requires aws-cli and jq. | |
group_name=$1 | |
group_id=`aws ec2 describe-security-groups --filters "Name=group-name,Values=$group_name" | \ |
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
require 'base64' | |
require 'cgi' | |
def show_session(cookie) | |
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first)) | |
end |
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
require 'base64' | |
// Decoding | |
cookie_value = 'CjpqE0+NhreIpEqgAyz3Ag==' | |
uid_hex_string = "uscc=" + Base64.decode64(cookie_value).unpack("VVVV").map{|x|x.to_s(16).rjust(8, '0')}.join.upcase | |
// Encoding with ruby > 1.9.2 | |
uscc = "136A3A0AB7868D4FA04AA48802F72C03" | |
cookie_value = Base64.safe_encode64(uscc.scan(/.{8}/).map{|x| x.to_i(16)}.pack("VVVV")) |