Skip to content

Instantly share code, notes, and snippets.

View kryptek's full-sized avatar

Alfred Moreno kryptek

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile
@kryptek
kryptek / gist:5460348
Last active December 16, 2015 15:59 — forked from bkimble/gist:1365005
#!/usr/bin/env ruby
require 'net/telnet'
require 'terminal-table'
tbl = Terminal::Table.new headings: %w(id expires cache_key bytes)
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
matches = localhost.cmd("String" => "stats items", "Match" => /^END/).scan(/STAT items:(\d+):number (\d+)/)
slabs = matches.inject([]) { |items, item| items << Hash[*['id','items'].zip(item).flatten]; items }
require "cgi"
class AkamaiTokenConfig
attr_accessor :window, :session_id, :data, :salt, :field_delimiter, :early_url_encoding, :ip
attr_reader :start_time, :hash_strategy, :acl, :url
def initialize(config={})
@ip = ''
self.start_time = Time.now.to_i
self.acl = '/*'

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham winhamwr@gmail.com

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@kryptek
kryptek / elb-describe.py
Created December 11, 2013 17:14
Retrieve an EC2 Load Balancers instances and their health status using python
import boto
import sys
ec2 = boto.connect_ec2()
elb = boto.connect_elb()
load_balancer = elb.get_all_load_balancers(load_balancer_names=[sys.argv[1]])[0]
health = load_balancer.get_instance_health()
instances = ec2.get_only_instances(instance_ids=[instance.id for instance in load_balancer.instances])
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
ack
bundle
cat
cd
cd-
ceedling
cp
curl
diff
find
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
#install openssl
#sudo aptitude install python-openssl
from OpenSSL import SSL
import socket, SocketServer
class SSlSocketServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
SocketServer.BaseServer.__init__(self, server_address,
@kryptek
kryptek / sample_wol.rb
Last active August 29, 2015 14:02 — forked from dgv/sample_wol.rb
#!/usr/bin/ruby
require 'socket'
begin
addr = ['<broadcast>', 9]
UDPSock = UDPSocket.new
UDPSock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
mac_address = ARGV[0]

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname