Skip to content

Instantly share code, notes, and snippets.

View bash-scripting-quoting.txt
# 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
View docker.md

In that way you can expose the docker service outside from the Virtual machine.

# /lib/systemd/system/docker.service
ExecStart=/usr/bin/docker -d -H tcp://0.0.0.0:2375 -H fd://

then

systemctl daemon-reload && sudo service docker restart
View browserstack_tunnel_setup.sh
#!/bin/bash
# Setup and start BrowserStack Tunnel for your TravisCI build
#
# This script was adopted from Santiago Suarez Ordoñez's Sauce Connect
# setup script: https://gist.github.com/santiycr/5139565/
#
# This script requires your .travis.yml to include the following private
# env variable:
#
@cirpo
cirpo / javascript_resources.md
Created Jan 19, 2014 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

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 / 0_reuse_code.js
Created Jan 19, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:1638981
<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
View gist:1638980
<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>
View OrdinativiMenuItemDayTable.class.php
<?php
class OrdinativiMenuItemDayTable extends Doctrine_Table
{
public static function getInstance()
{
return Doctrine_Core::getTable('OrdinativiMenuItemDay');
}
View gist:549466
<?php
class Pippo{
private _$asset = null;
public function getAsset()
{
if(null === $this->asset)
View exec.jsp
<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();
You can’t perform that action at this time.