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
/*
This widget shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code into the <head>:
@holly
holly / getswap.sh
Last active April 8, 2023 14:22 — forked from koemu/getswap.sh
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Updated: 2013-11-13 Yuichiro Saito
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
@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 / 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):
"""
@holly
holly / mysql_secure.sh
Created June 22, 2016 03:20 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@holly
holly / method_missing.py
Created October 15, 2016 14:40 — forked from ukyo/method_missing.py
method missing in python
class MethodMissing(object):
def __getattr__(self, name):
try:
return self.__getattribute__(name)
except AttributeError:
def method(*args, **kw):
return self.method_missing(name, *args, **kw)
return method
def method_missing(self, name, *args, **kw):
@holly
holly / md_sync_call.sh
Created January 17, 2021 15:11 — forked from tagomoris/md_sync_call.sh
Run "check" about specified md device if it's status is "idle"
#!/bin/sh
TARGET_MD=$1
### call md verifying when idle.
######
# HOW TO USE
### md_sync_call.sh md0
error_exit() {