jq is useful to slice, filter, map and transform structured json data.
brew install jq
/** | |
test str is formatted "11.2,46.1|11,46|11.2,46.1|11.1,46.2" | |
*/ | |
function validLocations(str) { | |
const regAll = /(?=^([^\|]*\|){3}[^\|]*$)(?=^([^,]*,){4}[^,]*$)/ | |
// contains min 3 pipe and 4 commas | |
, regPipe = /^([^\|]*\|){3,}[^\|]*$/ |
#!/usr/bin/env php | |
<?php | |
ob_start(); | |
if(isset($argv[1])) | |
$outfile = $argv[1]; | |
else | |
$outfile = 'index.html'; |
/* | |
usage: | |
cat config.template.yml | VAR1=test node envtmpl.js > config.valued.yml | |
*/ | |
const fs = require('fs'); | |
//const tmplReg = /\$\{(.+?)\}/g | |
const tmplReg = /\$\{([\w_\-]+)\}/g | |
//const tmplReg = /\{ *([\w_\-]+) *\}/g |
#!/bin/bash | |
# requirements: apt install nmap htop aha | |
# (aha is ANSI color to HTML converter) | |
ncat -k -l -p 9999 -c "echo 'HTTP/1.1 200 OK\nContent-type: text/html\nconnection: close\\n'; echo q | htop | aha --black --line-fix" |
const Nightmare = require('nightmare') | |
const nightmare = Nightmare({ | |
// show: true | |
}); | |
var url = process.argv[2] || 'http://labs.easyblog.it/', | |
prop = process.argv[3] || undefined; | |
Object.byString = function(o, s) { |
L.GeoJSONAutoClear = L.GeoJSON.extend({ | |
options: { | |
autoclear: true, | |
zoomdiff: 2 | |
}, | |
_autoClear: function(e) { | |
if(this.getLayers().length) { | |
if(e.target.getZoom() < e.target.getBoundsZoom(this.getBounds())-this.options.zoomdiff) | |
this.clearLayers(); | |
} |
sudo aptitude install ruby-full | |
sudo gem install sass | |
sudo gem install compass |