Skip to content

Instantly share code, notes, and snippets.

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 / remote_cert_remaining_days
Created December 4, 2012 16:38
openssl remote certificate remaining days one-liner function
remote_cert_remaining_days() { cert_remaining_time=$(date -d "$(openssl s_client -connect $1 2>/dev/null </dev/null | openssl x509 -enddate -noout | cut -d'=' -f2)" "+%s"); current_time=$(date "+%s"); echo remaining $((($cert_remaining_time - $current_time) / 60 / 60 / 24)) days; }
@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 / dar-differential-backup.sh
Last active December 16, 2015 23:59
dar easy backup
#!/bin/bash
# cron setting example
# 5 3 * * * ionice -c2 -n7 nice -n19 /usr/local/sbin/dar-differential-backup.sh >/dev/null 2>&1
# or
# ALLNICE="ionice -c2 -n7 nice -n19"
# BACKUP_SCRIPT="/usr/local/sbin/dar-differential-backup.sh"
# 5 3 * * 0 $ALLNICE $BACKUP_SCRIPT -f >/dev/null 2>&1
# 5 3 * * 1,2,3,4,5,6 $ALLNICE $BACKUP_SCRIPT -d >/dev/null 2>&1
@holly
holly / rsync-link-dest.sh
Created June 8, 2013 16:23
rsync --link-dest
@holly
holly / smtp-auth-pass.sh
Created August 3, 2013 14:46
for smtp auth telnet check easy tool
#!/bin/bash
set -e
_plain() {
local user=$1
local pass=$2
echo -ne "$user\0$user\0$pass" | openssl enc -base64 | tr -d '\n'; echo
@holly
holly / ipv4-for-delegated-apnic-latest.sh
Created August 12, 2013 13:37
ipv4-for-delegated-apnic-latest.sh CC [DELEGATED_APNIC_LATEST]
#!/bin/bash
MASK=32
SEP='|'
IPV4=ipv4
SCRIPT=$(basename $0)
DELEGATED_APNIC_LATEST=http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
if [ $# -lt 1 ]; then
echo "Usage: $SCRIPT CC [DELEGATED_APNIC_LATEST]"
@holly
holly / pgpool_failover.sh
Created October 13, 2013 04:34
pgpool failover script(pg_ctl promote) failover_command = '/path/to/pgpool_failover_stream.sh %d %H %R'
#!/bin/bash
set -e
SSH=/usr/bin/ssh
PGCTL=/usr/bin/pg_ctl
failed_node=$1
new_master=$2
cluster_path=$3