Skip to content

Instantly share code, notes, and snippets.

@DnaX
DnaX / QueryBuilder.java
Created February 28, 2013 01:37
A simple Java QueryBuilder for Play! Framework with support for SELECT, INSERT, UPDATE and DELETE statements. Useful for interface with database without ORM support (like Hibernate, JPA, etc.).
/**
* Simple Java query builder for Play! Framework
*
* Author: Daniele Napolitano <dnax88@gmail.com>
*
* Features:
*
* Support for SELECT, INSERT, UPDATE and DELETE statements.
* No support for multiple tables, JOINs, GROUP BY
* WHEREs concatenated only with AND
@DnaX
DnaX / sites_check.sh
Last active January 27, 2024 14:28
This shell script check the availability of web sites probing them with curl. With HTTP status code >= 400 the site is considered unavailable (and the script return 1). The script check also response time without affect script status code. On terminal the output is colored instead on redirect (for example when log script results into file) the o…
#!/bin/bash
# sites to check
site=(
"www.google.com"
"www.github.com"
# insert here other sites...
)
# color costants
@DnaX
DnaX / getCNSPersonalData.py
Created March 9, 2012 12:13
CNS smart card PersonalData extractor (by PKCS#11 library)
#!/usr/bin/env python
# Uses OpenSC pkcs11 generic library and pkcs11 python wrapper
# Print personal data from che italian CNS smart card (new health card)
from PyKCS11 import LowLevel
import sys
def getPersonalData(p11, slot):