Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ -z "$HOSTNAME" ]; then
echo 'input $HOSTNAME'
read HOSTNAME
fi
if [ -z "$ROOT_PASSWORD" ]; then
echo 'input $ROOT_PASSWORD'
read ROOT_PASSWORD
@holly
holly / Check server
Last active August 29, 2015 14:16 — forked from Oneiroi/Check server
openssl s_client -cipher EXPORT -connect domain.com:443 < /dev/null 2>/dev/null | grep SSL-Session | wc -l
@holly
holly / nc-http.sh
Created October 11, 2015 12:48
oneliner http server
while true; do echo -n -e "HTTP/1.1: 200 OK\n\nHello world\n" | nc -l 8080; done
package Mojolicious::Plugin::Pipeline::CSSCompressor;
use Mojo::Base 'Mojolicious::Plugin';
use CSS::Compressor 'css_compress';
sub register {
my ($self, $app) = @_;
# Register "css_compressor" filter
$app->filter(css_compressor => sub { css_compress shift });
@holly
holly / subdomain vhost config
Created November 19, 2012 16:31
apache cakephp vhost config
<VirtualHost *:80>
#this handles sitename.example.com
ServerName example.com
ServerAlias *.example.com
Options -Indexes FollowSymLinks
UseCanonicalName Off
VirtualDocumentRoot /opt/example/sites/%1/app/webroot
@holly
holly / verify_keypair
Created December 4, 2012 15:53
openssl key and cert verify pair one-liner function
verify_keypair() { diff <(openssl rsa -in $1 -modulus -noout) <(openssl x509 -in $2 -modulus -noout) >/dev/null 2>&1 ; return $?; };
@holly
holly / debug_keypair
Created December 5, 2012 05:30
openssl key and cert debug pair one-liner function
debug_keypair() { (openssl s_server -cert $2 -key $1 -CAfile $3 -www -no_ssl2 -accept 4433) & sleep 1; if ! lsof -i:4433; then return 1; fi; jobid=$(jobs %?"openssl s_server" | sed -e 's/^\[\(.\+\)\].*/\1/'); openssl s_client -connect localhost:4433 -showcerts -ssl3 -CAfile $3 </dev/null; kill %$jobid; return 0; }
@holly
holly / inotify.py
Created November 15, 2015 04:27 — forked from quiver/inotify.py
Python implementation of "IBM DeveloperWorks : Monitor Linux file system events with inotify"
import collections
import ctypes
import ctypes.util
# bit masks
IN_ISDIR = 0x40000000
IN_ALL_EVENTS = 0xfff
class inotify_event_struct(ctypes.Structure):
"""
#!/usr/bin/env python
from ctypes import CDLL, CFUNCTYPE, c_char_p, c_int, c_uint32
from ctypes.util import find_library
import argparse
import os
import struct
import sys
import select
cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w48 | head