Skip to content

Instantly share code, notes, and snippets.

View agea's full-sized avatar
🐺
trying to invent

Andrea Agili agea

🐺
trying to invent
View GitHub Profile
@agea
agea / jboss.sh
Created January 31, 2011 16:06
JBoss init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: run.sh
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable JBoss Server.
@agea
agea / alfrescoShortUrl.md
Created May 24, 2012 06:48
Alfresco Short URL

How to create a simple url shortener for Alfresco (>=4.0):

  1. Create the Shortable Aspect:

    • Copy shortUrlModel.xml in the repository in /Data dictionary/Models
    • edit document properties and activate the model
  2. Make the aspect and the property visible:

    • Add the content of share-config-custom.xml to /tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
  • restart Alfresco
hdiutil create -size 100g -type SPARSEBUNDLE -nospotlight -volname "TM Disk" -fs "Case-sensitive Journaled HFS+" tm_disk
mv tm_disk.sparsebundle /Volumes/share/
sudo defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
killall "Finder"
hdiutil attach -verbose /Volumes/share/tm_disk.sparsebundle
@agea
agea / animated.html
Created December 6, 2012 08:14
Urban terror Log visualization
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* { margin: 0; padding: 0;}
body, html { height:100%; background: white;}
</style>
@agea
agea / resizeall.py
Created January 9, 2013 01:54
Resize all images in folder an descendants
#!/usr/bin/python
import sys, os, logging, math, ConfigParser, random,inspect
import Image, ImageStat
frameSize = (720,480)
frameRatio = float(frameSize[0])/float(frameSize[1])
def files(folder):
<html>
<!--
This is an example of how to make browsers
offer to remember password and later fill in those passwords
for dynamic login forms.
To make the browser offer to remember passwords the form should be actually submitted.
Since we are handling login with AJAX we don't want the form to submit, so we are still submitting it
into a dummmy iframe with dummy URL.
It's good idea to actually create empty dummy.html file, otherwise you'll flood you error.log with 404s
/**
* Correct version of a wysihtml5 binding for KnockoutJS that is safe for multiple inclusion on a single page
*/
ko.bindingHandlers.wysihtml5 = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var control = $(element).wysihtml5({
"events": {
"change" : function() {
var observable = valueAccessor();
observable(control.getValue());
@agea
agea / gist:5771901
Last active December 18, 2015 10:58 — forked from tommorris/gist:2795214
import sys
import csv
import httplib, urllib, base64
def main():
# set the name of your repository, username and password
username = "test"
password = "test"
repo = "user/repo"
@agea
agea / sql2graphml.groovy
Last active November 7, 2018 06:01
Generate Graphml ER Diagram from SQL Connection
import groovy.sql.*
def tables = [:]
def visitTable = { dbmd, schema, tableName ->
if (!tables[tableName]) {
tables[tableName] = new HashSet()
}
def keyRS = dbmd.getExportedKeys(null, schema, tableName)
while (keyRS.next()) {
{
"cmd": ["rsync",
"-avz",
"--exclude",
"'.svn*'",
"/src/folder",
"/dest"]
}