This file contains hidden or 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
<VirtualHost *:80> | |
ServerName example.com | |
ServerAlias www.example.com | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/html/example.com | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
<Directory "/var/www/html/example.com"> |
This file contains hidden or 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
# Who has contributed the most to your repository? Both in terms of | |
# net additions, and total changes. (Just change $_->{loc_net} to | |
# $_->{loc_tot} at the end of the command. | |
(printf -- '---\nchanges:\n'; git log --stat --format=' - name: %aE' | grep -v -e \| -e ^$ | sed -re 's/[^,]+, / loc: /' -e 's/([0-9]+) insertions?\(\+\)/\1/' -e 's/(, )?([0-9]+) deletions?\(-\)/-\2/' ) | perl -MYAML -MData::Dumper -E '$db = Load(do { local $/; <> })->{changes}; @p = map { { loc_net => eval "$_->{loc}", loc_tot => eval($_->{loc} =~ s/-/+/r) , name => $_->{name} } } @$db; print Dump \@p' | perl -MYAML -E '$db = Load(do { local $/; <> }); my $h = {}; $h->{$_->{name}} += $_->{loc_net} for @$db; print Dump $h' | sort |
This file contains hidden or 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
import random | |
class DontExperiment(Exception): | |
pass | |
def experiment(rate=0.1): | |
""" | |
Generate an experiment decatorator; it will raise an DontExperiment | |
exception with a probability of <rate>. | |
This file contains hidden or 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
perl -E 'say join(".", map {hex} reverse( shift =~ /(..)/g ) )' 0100007F |
This file contains hidden or 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
# Credit to Martinus at | |
# http://www.irishastronomy.org/index.php?option=com_kunena&view=topic&Itemid=211&catid=28&id=90354 | |
# make your screen only show red tones | |
for c in green blue; do | |
xcalib -$c .1 0 1 -alter | |
done | |
# reset it with "xcalib -clear". |
This file contains hidden or 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
perl -M5.010 \ | |
-MFile::Slurp -MYAML -MBencode=bdecode,bencode -MDigest::SHA=sha1_hex \ | |
-e 'say sha1_hex bencode bdecode(scalar read_file shift)->{info}' \ | |
<torrentfile> |
This file contains hidden or 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
printf "====[ %3s%-3s ]====\n", | |
substr($title, 0, length($title)/2), | |
substr($title, length($title)/2); |
This file contains hidden or 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
% vim: ts=2:sw=2:noet:tw=80 | |
% dnspkt.erl: Parse a dns query packet. | |
% Copyright 2013, Olof Johansson <[email protected]> | |
% | |
% Copying and distribution of this file, with or without | |
% modification, are permitted in any medium without royalty | |
% provided the copyright notice are preserved. This file is | |
% offered as-is, without any warranty. |
This file contains hidden or 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
" hilight trailing whitespace | |
highlight wsEOL ctermbg=red guibg=red | |
match wsEOL /\v\s+$/ | |
au InsertLeave * match wsEOL /\v\s+$/ | |
au InsertEnter * match wsEOL /\v\s+\%#\@<!$/ |
This file contains hidden or 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
qsort1([]) -> []; | |
qsort1([H|T]) -> qsort1([X||X<-T,X<H])++[H]++qsort1([X||X<-T,X>=H]). |