Skip to content

Instantly share code, notes, and snippets.

View lusentis's full-sized avatar

Simone Lusenti lusentis

View GitHub Profile
@lusentis
lusentis / makePassword.js
Created February 10, 2014 11:55
Make a random password
'use strict';
var PASS_LENGTH = [1, 4, 2];
var _makePassword = module.exports.makePassword = function () {
var a = [
'ABCDEFGHJKMNPQRSTUVXZ',
'abcdefghjkmnpqrstuvxz',
'23564789'
].map(function (i) { return i.split(''); });
@lusentis
lusentis / gist:9120366
Last active August 29, 2015 13:56
automagically setup python & nodejs workspace
#!/bin/bash
if [ -f ".virtualenvname" ]; then
echo "~ detected python project ~"
echo "~ switcing to virtualenv $(cat .virtualenvname)"
workon $(cat .virtualenvname)
pip install -r requirements.txt
fi
# -.- coding: utf-8 -.-
import json
import urllib2
import predictionio
client = predictionio.Client(appkey="XXXXXXXXXXXXXXXXXXXXXXX")
total = 6028561
size = 1000

Keybase proof

I hereby claim:

  • I am lusentis on github.
  • I am slusenti (https://keybase.io/slusenti) on keybase.
  • I have a public key whose fingerprint is B9FB B8B3 7D30 F2F6 1AB8 1168 11A0 1A91 E12B 1737

To claim this, I am signing this object:

@lusentis
lusentis / textnazi.js
Last active August 29, 2015 14:10
Fixup text typed by dumb italian people
/*jshint node:true, esnext:true */
'use strict';
module.exports.police = function (text) {
if (!text) { return ''; }
text = text.replace(/(\s| )+/g, ' '); // compact multiple places
text = text.replace(/e'\s+/g, 'è '); // apos -> accent
text = text.replace(/o'\s+/g, 'ò ');
@lusentis
lusentis / Jakefile
Last active August 29, 2015 14:27
Lambda Toolkit
/*eslint quotes: [0] */
/*global desc, task, watchTask, complete, jake */
var assert = require('assert');
assert(process.env.NODE_ENV, 'NODE_ENV must be set');
var EXEC_OPTS = { printStdout: true, printStderr: true };
desc('Build the source with webpack');
task('build', { async: true }, function () {
@lusentis
lusentis / router.coffee
Created June 24, 2012 12:31
RouterJS - A framework-independent BrowserJS routing and m[vc] lib
###
RouterJS - A framework-independent BrowserJS routing and m[vc] lib
Dependencies: RequreJS for loading, Handlebars for templates, jQuery for ajax and selectors
Part of Plee.co Frontend
(c) 2012 PlasticPanda.com
~ relying solely on what’s been done in the past
@lusentis
lusentis / xselect.coffee
Created June 26, 2012 08:50
x-select custom tag
###
PandaSelect - replaces HTML selects
Dependencies: RequreJS for loading, jQuery for selectors
Part of Plee.co Frontend
(c) 2012 PlasticPanda.com
~ relying solely on what’s been done in the past
@lusentis
lusentis / pandapicker.coffee
Created June 27, 2012 16:00
Plasticpanda Date Picker
# PlasticPanda.com - Date Picker
## cofigurable parameters
cssPrefix = 'pandapicker-'
template_html = """
<table role="datepicker">
<thead>
<tr>
@lusentis
lusentis / randpass.jade
Created June 30, 2012 19:24
Browser-JS random password generator applet
//- A general purpose not-so-random string generator
//- This file is in public domain
//- by Simone Lusenti - PlasticPanda.com, 2012
doctype 5
html
head
meta(charset='utf-8')
meta(name='Content-Type', value='text/html')
title Random pass generator