This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#rsyslog SERVER | |
# Activate kernel logging | |
$ModLoad imklog | |
# Activate TCP logging | |
$ModLoad imtcp | |
# Activate UDP logging | |
$ModLoad imudp | |
# Activate unix socket logging (used by syslog(3) system calls) | |
$ModLoad imuxsock | |
# Activate the 'ommail' module, used to forward messages via SMTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to override DNS on Mac OS X 10.5 | |
sudo dscl localhost -create /Local/Default/Hosts/site.dom IPAddress 127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hexdate.sh | |
# Gives the hexadecmial representation of time_t | |
# If the hexadecimal representation of time_t is given as an argument, will print the date that time represented. | |
# | |
# Joel Franusic, 49ff6dcc | |
if [ $# -eq 0 ]; then | |
echo "obase=16;`date +%s`" | bc | tr '[A-Z]' '[a-z]' | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to exit if any command in a bash subshell fails. | |
exitIfFailed () | |
{ | |
rv=$?; | |
if [ $rv -ne 0 ]; then | |
exit $rv; | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all files that you can read in /tmp | |
find /tmp/ -type f -perm -004 | xargs ls -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to automatically backup a git repository (via cron for example). | |
REPOSITORY="/path/to/repository/" | |
# Redirect STDIO and STDERR to /dev/null | |
exec 1> /dev/null | |
exec 2> /dev/null | |
cd $REPOSITORY | |
git add . | |
git commit -a -m "Automatic commit - `date`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Makes test vectors for prolog. | |
use Data::Dumper; | |
use Digest::MD5 qw(md5 md5_hex md5_base64); | |
my @testcases = qw( | |
291546831b9f9975c4b9d80b8a83fa75 | |
b959f348cd1ea2cd4c9845656e87e256 | |
ec696acce6fc9a57bccb4bd070bb3ab0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# Proof of concept for implementing boolean AND and OR logic in Nginx. | |
use strict; | |
my @truth_table = ( | |
['0', '0', '1', '0'], | |
['0', '1', '0', '0'], | |
['0', '1', '1', '0'], | |
['1', '0', '0', '0'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to redirect HTTP to HTTP and HTTPS to HTTPS | |
RewriteEngine On | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=302,L] | |
RewriteCond %{SERVER_PORT} 443 | |
RewriteRule ^(.*)$ https://www.DOMAIN.com/$1 [R=302,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input: email address in pasteboard. | |
# output: url for gravatar of that email address to pasteboard | |
# (wavatar default if no gravatar exists) | |
md=$(echo -n `pbpaste` | md5); echo "http://gravatar.com/avatar/${md}?d=wavatar" | pbcopy |
OlderNewer