Skip to content

Instantly share code, notes, and snippets.

@dysinger
dysinger / gentoo-ec2.sh
Created March 31, 2009 22:36
Bare Minimum to boot Stage3 gentoo @ ec2
#!/bin/sh
# -*- sh -*-
# NOTE: This is the bare min needed to make an ec2 image from a stage3 gentoo image.
# !st Build a stage3 from somewhere. I use metro. ...then... ->
#
# Configure
#
@somic
somic / gist:123889
Created June 4, 2009 22:16
Prints out how many seconds ago this EC2 instance was started
#!/bin/bash
#
# Prints out how many seconds ago this EC2 instance was started
#
# It uses Last-Modified header returned by EC2 metadata web service, which as far
# as I know is not documented, and hence I assume there is no guarantee
# that Last-Modified will be always set correctly.
#
# Use at your own risk.
#
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)
self.database()
@mtigas
mtigas / gist:952344
Last active June 20, 2024 11:22
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@wheresalice
wheresalice / redisdns.py
Created November 27, 2011 12:56
Python DNS server with Redis backend
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket
@waffle2k
waffle2k / perl-decorators.pl
Created March 14, 2012 05:36
An example of creating decorators in Perl
package Profiler::Decorator;
use IO::Socket::INET;
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock stat );
use Data::Dumper;
# flush after every write
# We call IO::Socket::INET->new() to create the UDP Socket
# and bind with the PeerAddr.
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active July 4, 2024 17:31
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@shamil
shamil / howto_deb_repackage.txt
Created July 19, 2012 03:29
Howto repackage deb packages
Use folowing steps to repackage dep package:
1: Extract deb package
# dpkg-deb -x <package.deb> <dir>
2: Extract control-information from a package
# dpkg-deb -e <package.deb> <dir/DEBIAN>
3. After completed to make changes to the package, repack the deb
# dpkg-deb -b <dir> <new-package.deb>
@solar
solar / install.sh
Created October 16, 2012 09:56
install zookeeper with supervisord
#!/usr/local/bin/zsh
version="3.4.4"
priority="30404"
sudo mkdir -p /var/log/zookeeper /usr/local/zookeeper /var/zookeeper
curl -L http://ftp.kddilabs.jp/infosystems/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz | tar zx
sudo cp -r zookeeper-${version} /usr/local/zookeeper/${version}
sudo cp ./zookeeper.sh /usr/local/zookeeper/
sudo cp ./zoo.cfg /etc/