Skip to content

Instantly share code, notes, and snippets.

View cosimo's full-sized avatar
🇳🇴

Cosimo Streppone cosimo

🇳🇴
View GitHub Profile
@cosimo
cosimo / pre-commit
Created February 26, 2014 12:59
Puppet manifests and templates syntax check git pre-commit hook
#!/bin/bash
# pre-commit hook to syntax check puppet manifests and erb templates
# at checkin.
# Stig Sandbeck Mathisen <ssm@fnord.no>
#
# Modified to run with puppet < 2.7 as well, Cosimo 13/Dec/2011
#
# Requirements:
@gimler
gimler / memcached
Created October 6, 2010 07:39 — forked from jonhiggs/memcached
#! /bin/bash
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: memcached - Memory caching daemon
@cosimo
cosimo / gist:803454
Created January 31, 2011 00:07
Opera contacts to Mutt aliases converter
#!/usr/bin/env perl
#
# Convert Opera contacts file (.adr) into
# mutt aliases file format.
#
# Usage:
# perl opera-adr-to-mutt-aliases.pl < ~/.opera/contacts.adr >> ~/.mutt/aliases
#
# Cosimo, 31/Jan/2011
#
@avar
avar / moose-vs-pure-perl.pl
Created March 7, 2011 10:59
Comparing the speed of Moose v.s. Moose immutable v.s. the pure-Perl equivalent for object construction and retrieval
#!/usr/bin/env perl
# The way you usually do it with Moose
package Moosy {
use Moose;
has number => (
is => 'ro',
isa => 'Int',
);
@cosimo
cosimo / gist:884307
Created March 24, 2011 00:05
Convert svn tags to git tags
#!/bin/bash
#
# Convert remote tags imported from SVN to real git tags
#
REMOTE_TAGS=$(git branch -r | grep 'tags/' | cut -f2 -d/)
GIT=$(which git)
for t in $REMOTE_TAGS
do
Cpu(s): 10.0%us, 7.0%sy, 0.0%ni, 80.6%id, 0.0%wa, 0.0%hi, 2.4%si, 0.0%st
Mem: 1058730500k total, 22323100k used, 1036407400k free, 103608k buffers
Swap: 11558908k total, 0k used, 11558908k free, 2564672k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
132101 nobody 20 0 2239m 904m 748m S 2117 0.1 53:26.55 varnishd
132977 test 20 0 23952 1728 1260 R 100 0.0 0:56.71 httperf
132978 test 20 0 23952 1728 1260 R 100 0.0 0:54.73 httperf
132980 test 20 0 23952 1732 1260 R 100 0.0 0:43.50 httperf
132981 test 20 0 23952 1728 1260 R 100 0.0 0:34.78 httperf
@cosimo
cosimo / check-debian-version.sh
Created November 23, 2011 16:59
Quickly tells the Debian version running on a given host. Requires ssh server enabled.
#!/bin/sh
#
# Tells the Debian version reading the OpenSSH banner
# Requires OpenSSH to be running and ssh port to be open.
#
# Usage: $0 <hostname>
#
# Cosimo, 23/11/2011
HOST=$1
from selenium import webdriver
driver = webdriver.Opera()
driver.get_screenshot_as_file('/Users/ato/Desktop/1.png')
driver.quit()
@cosimo
cosimo / custom-head.html
Created August 25, 2012 08:57
OSQA responsive layout
<meta name="viewport" content="width=device-width, initial-scale=1">
@pjf
pjf / exifpic.pl
Last active December 10, 2015 09:58 — forked from anonymous/exifpic
# /usr/bin/perl -w
use 5.010;
use strict;
use warnings;
use threads;
use Thread::Queue;
use autodie qw(:all);
use Image::ExifTool qw(ImageInfo);
use Data::Dumper;
use Imager;