Skip to content

Instantly share code, notes, and snippets.

View francolaiuppa's full-sized avatar

Franco Laiuppa francolaiuppa

View GitHub Profile
@francolaiuppa
francolaiuppa / data.json
Created January 19, 2017 10:06
Sample multiline JSON for demos
{
"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
"servlet-class": "org.cofax.cds.CDSServlet",
"init-param": {
"configGlossary:installationAt": "Philadelphia, PA",
"configGlossary:adminEmail": "ksm@pobox.com",
"configGlossary:poweredBy": "Cofax",
@francolaiuppa
francolaiuppa / data.json
Created January 18, 2017 16:19
Sample monoline JSON data
{"web-app":{"servlet":[{"servlet-name":"cofaxCDS","servlet-class":"org.cofax.cds.CDSServlet","init-param":{"configGlossary:installationAt":"Philadelphia, PA","configGlossary:adminEmail":"ksm@pobox.com","configGlossary:poweredBy":"Cofax","configGlossary:poweredByIcon":"/images/cofax.gif","configGlossary:staticPath":"/content/static","templateProcessorClass":"org.cofax.WysiwygTemplate","templateLoaderClass":"org.cofax.FilesTemplateLoader","templatePath":"templates","templateOverridePath":"","defaultListTemplate":"listTemplate.htm","defaultFileTemplate":"articleTemplate.htm","useJSP":false,"jspListTemplate":"listTemplate.jsp","jspFileTemplate":"articleTemplate.jsp","cachePackageTagsTrack":200,"cachePackageTagsStore":200,"cachePackageTagsRefresh":60,"cacheTemplatesTrack":100,"cacheTemplatesStore":50,"cacheTemplatesRefresh":15,"cachePagesTrack":200,"cachePagesStore":100,"cachePagesRefresh":10,"cachePagesDirtyRead":10,"searchEngineListTemplate":"forSearchEnginesList.htm","searchEngineFileTemplate":"forSearchEngines
@francolaiuppa
francolaiuppa / sequelize-schema-file-generator.js
Last active August 5, 2020 14:25 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
'use strict';
//////////////////////////////////
// How to use?
// 1. Create `sequelize-schema-file-generator.js` in your app root
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders).
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports)
// 4. Run it with `node sequelize-schema-file-generator.js`
// 5. Review the generated migrations inside of the `migrations` folder.
//////////////////////////////////
@francolaiuppa
francolaiuppa / gist:e6911b51a7602e569821e8fc3e11c0bd
Created September 16, 2016 11:50
Install lvm tools + vim in CentOS 7.2
[root@docker-private-registry ~]# yum install -y lvm2* vim vim-common
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/2): extras/7/x86_64/primary_db
@francolaiuppa
francolaiuppa / gist:5556616ccbc76056cd1d
Created March 31, 2015 19:37
hackealo.co solucionador. SPOILER: Aunque pongas la respuesta correcta no funciona
// "acb" es (1*1) + (2*3) + (3*2).
var letters = ['a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w','y','x','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','Y','X','Z'];
// var word = 'HZyVYIW'.toLowerCase().split('');
var word = 'HZyVYIW'.split('');
var total = 0;
var msg = '';
@francolaiuppa
francolaiuppa / gist:9507d003c9694c451bee
Created November 14, 2014 18:57
Example HAProxy 1.5 configuration for load-balancing Redis nodes with Sentinel (including health checks!)
backend messages
mode tcp
option tcplog
option tcp-check
#tcp-check send AUTH\ foobar\r\n
#tcp-check expect +OK
tcp-check send PING\r\n
tcp-check expect +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
@francolaiuppa
francolaiuppa / express-controller.js
Last active April 21, 2023 17:31
Express JS + Amazon S3 + DropzoneJS Code Snippet
// Requires https://www.npmjs.org/package/s3-policy and https://www.npmjs.org/package/node-uuid
var config = require('env/' + process.env.NODE_ENV),
policy = require('s3-policy'),
uuid = require('node-uuid');
// SETUP S3
const AWS_ACCESS_KEY = config.s3.accessKey;
const AWS_SECRET_KEY = config.s3.secret;
const S3_BUCKET = config.s3.bucket;
@francolaiuppa
francolaiuppa / gist:40147b4bc92f576cb09d
Created August 11, 2014 20:17
Amazon S3 CORS Configuration (DANGER: DEVELOPMENT ONLY, NOT MEANT FOR PRODUCTION ENVIRONMENTS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<?php
function droplr($droplrUrl = 'http://d.pr/i/YBbX') {
$data = file_get_contents($droplrUrl);
$result = array();
$dom = new DOMDocument;
$dom->loadHTML($data);
foreach ($dom->getElementsByTagName('img') as $node) {
$result[] = $dom->saveHtml($node);
}
$scrapedImage = array_pop($result);