Skip to content

Instantly share code, notes, and snippets.

# Bash Scripting - Quoting
Chiunque abbia usato seriamente la Bash si è scontrato almeno una volta (e probabilmente più di una) con problemi legati al quoting.
Uno dei problemi più comuni è la difficoltà nello script che non riescono a gestire casi in teoria semplici come i file con uno spazio nel nome. Quasi come se fosse impossibile gestire dei file con nomi di quel tipo.
In realtà, anche se quasi nessuno sa come, con la Shell è possibile gestire file con nomi contenenti praticamente qualsiasi cosa. Per come è fatta Bash è possibile lavorare con qualsiasi nome di file che il kernel sia in grado di gestire. Quindi, ammesso di conoscere bene le regole del quoting, si può lavorare con problemi sia con i file con nomi contenenti spazi, sia pure con file con nomi contententi le più strane sequenze unicode (dagli emoji della birra a pure alle sequenze unicode non ancora definite nello standard).
Il quoting della shell, se usato correttamente, permette di gestire qualsiasi nome di file. Molti trovano difficolt
@cirpo
cirpo / 0_reuse_code.js
Created January 19, 2014 20:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cirpo
cirpo / javascript_resources.md
Created January 19, 2014 20:07 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@cirpo
cirpo / gist:1638981
Created January 19, 2012 09:37 — forked from fabiofabbrucci/gist:1638978
Vhost syfony2
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/Symfony/web/"
ServerName symfony
<Directory "/var/www/Symfony/web/">
Options All Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
AllowOverride all
@cirpo
cirpo / gist:1638980
Created January 19, 2012 09:37 — forked from fabiofabbrucci/gist:1638978
Vhost syfony2
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/Symfony/web/"
ServerName symfony
<Directory "/var/www/Symfony/web/">
Options ExecCGI FollowSymLinks Includes MultiViews
AllowOverride All
Allow from all
</Directory>
<?php
class OrdinativiMenuItemDayTable extends Doctrine_Table
{
public static function getInstance()
{
return Doctrine_Core::getTable('OrdinativiMenuItemDay');
}
@cirpo
cirpo / gist:549466
Created August 25, 2010 13:11 — forked from odino/gist:549438
<?php
class Pippo{
private _$asset = null;
public function getAsset()
{
if(null === $this->asset)
<HTML>
<BODY>
<%
String cmd = "/tmp/test.sh" ;
Runtime run = Runtime.getRuntime() ;
Process pr = run.exec(cmd) ;
InputStream in = pr.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder sb = new StringBuilder();
@cirpo
cirpo / gist:505528
Created August 2, 2010 23:41 — forked from odracci/gist:505473
append a carachter after n carachters
<?php
$number = '0123456789394872394';
$match = array();
preg_match_all('/(.{1,3})/', $number, $match);
$res = implode(' ', $match[0]);
var_dump($res);
?>
lab:
lab1:
name: S.C. Laboratorio Istocompatibilità IBMDR
lab2:
name: S.C. Laboratorio di genetica umana
project:
p1:
title: Analisi dei dati HLA del Registro Italiano di Donatori di Midollo Osseo e dei pazienti
description: