Skip to content

Instantly share code, notes, and snippets.

@danielepiccone
danielepiccone / sample.sh
Created January 29, 2019 09:49
Sample images to different sizes
#!/bin/bash
image=$1
sizes="1000 5000 7500 10000"
if test -z "$image"; then
echo "Missing image file"
exit 1
fi
for size in $sizes; do
@danielepiccone
danielepiccone / index.html
Last active January 23, 2019 13:48
string split and multiline regexp #jsbench #jsperf (https://jsbench.github.io/#cb16e341e5066b5dacae52c933407310) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>string split and multiline regexp #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@danielepiccone
danielepiccone / watchsrc.sh
Last active January 10, 2019 10:00
one liner watcher / compile steps
#!/bin/bash
while true; do inotifywait src/*; npm run build; done
@danielepiccone
danielepiccone / trackingdog-multi.js
Created June 6, 2018 09:08
pipe a full stack trace into trackingdog, preferred usage: xclip -o -selection clipboard | ./trackindog-multi
#!/usr/bin/env node
const TrackingDog = require('trackingdog/lib/TrackingDog');
const exec = require('child_process').exec;
const stackFramesRe = /(https?:\/\/[^:]*:[^:]*:[^: ]*)/g;
const codeLineRe = /(https?:\/\/[^:]*):(\d*):(\d*)/;
const trackingdog = new TrackingDog({});
function consumeStream(stream) {
import React from 'react';
import { getDataFromTree } from 'react-apollo/lib/index';
class AsyncRoute extends React.Component {
constructor(props) {
super(props);
this.state = {
route: props.children
};
}
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@danielepiccone
danielepiccone / gist:7656716
Created November 26, 2013 11:12
Symlink fix for Win7/Virtualbox
VBoxManage setextradata Developement VBoxInternal2/SharedFoldersEnableSymlinksCreate/Dev 1
VBoxManage setextradata Developement VBoxInternal2/SharedFoldersEnableSymlinksCreate/htdocs 1
@danielepiccone
danielepiccone / onchange.sh
Last active December 26, 2015 16:29 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@danielepiccone
danielepiccone / list browser events
Created August 21, 2013 08:28
list browser events
var i = '', out = [];
for (i in window) {
if ( /^on/.test(i)) { out[out.length] = i; }
}
console.log( out.join(', ') );