Skip to content

Instantly share code, notes, and snippets.

View cosimo's full-sized avatar
🇳🇴

Cosimo Streppone cosimo

🇳🇴
View GitHub Profile
@troyane
troyane / SNER_preparer
Last active February 1, 2023 21:53
Script to prepare Stanford NER to work with your Python and NLTK
#!/bin/bash
mkdir my_project
cd my_project
echo " . . . Downloading file stanford-ner-2014-08-27.zip"
# NOTE: need to update link for further versions
wget http://nlp.stanford.edu/software/stanford-ner-2014-08-27.zip
echo " . . . Unpacking stanford-ner-2014-08-27.zip"
@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:
@KristianLyng
KristianLyng / HELLO-WORLD.cobol
Created June 10, 2013 16:32
This is what the world has been waiting for: Integration of COBOL and Varnish. http://kly.no/varnish/cobol.png
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
@andreas-marschke
andreas-marschke / minify.pm
Last active December 17, 2015 16:49
Mojolicious Command to minify all CSS/JS Scripts in a directory and save minified versions as .min.{js|css}
package Mojolicious::Command::minify;
use Mojo::Base 'Mojolicious::Commands';
use File::Find;
use File::Slurp;
has description => "Minify scripts in public/ directory.\n";
has hint => <<"EOF";
Minifies all Javascript and CSS files with the .js instead of the .min.js extension.
EOF
@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;
@cosimo
cosimo / custom-head.html
Created August 25, 2012 08:57
OSQA responsive layout
<meta name="viewport" content="width=device-width, initial-scale=1">
@cosimo
cosimo / find-unused-css-selectors.pl
Created July 26, 2012 14:09
Find unused CSS selectors across a list of URLs
#!/usr/bin/env perl
#
# Find unused CSS selectors by crawling a list of URLs
# (--url, even more than one) and matching all elements in
# a page to find out which selectors are never used across
# all given URLs
#
# Usage:
# ./find-unused-css-selectors.pl --css file.css --url http://some.url [--url http://some.other.url ...]
#
@andreasbovens
andreasbovens / viewport-meta-in-20-best-responsive-designs.md
Created July 17, 2012 15:56
Viewport meta tags used by the 20 sites that are listed in Social Driver's "20 Best Responsive Web Design Examples of 2012"

Intro

http://socialdriver.com/2012/07/20-best-responsive-websites/ lists 20 sites that are supposedly best-in-class when it comes to responsive design techniques. I had a look at the viewport meta tags used in these sites.

Findings

  • All sites use width=device-width, with in most cases an additional initial-scale=1. This is good practice.

However:

  • 8 sites turn off pinch-zooming by setting maximum-scale to 1, or using user-scalable=no. While there are some corner use cases for this, it does not make sense to do this on text-heavy sites as it impairs accessibility.
  • 3 sites use semi-colons as delimiters between viewport values. While this works in newer mobile browsers, it's not officially supported, and breaks in older mobile browser versions.
  • 1 site has 2 viewport meta tags (with different values) in the source...
@throughnothing
throughnothing / parks.pl
Created April 30, 2012 03:50
spark clone in perl
#!/usr/bin/env perl
# parks - spark clone in perl (https://github.com/holman/spark)
# Alternatives: https://github.com/holman/spark/wiki/Alternative-Implementations
# Wicked Cool Examples: https://github.com/holman/spark/wiki/Wicked-Cool-Usage
use List::Util qw( min max ); local $/;
my ($t, @n) = ( [qw(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)], -t STDIN ? @ARGV : split ' ', <STDIN> );
print map($t->[ int( ( $_ - min(@n) ) / max(@n) * $#$t ) ], @n), "\n";
from selenium import webdriver
driver = webdriver.Opera()
driver.get_screenshot_as_file('/Users/ato/Desktop/1.png')
driver.quit()