Skip to content

Instantly share code, notes, and snippets.

View nikiink's full-sized avatar

Nicola Inchingolo nikiink

  • Andria, BT, Italy
View GitHub Profile
/*
Il server sia in grado di gestire un metodo get condizionale
sulla base dell'ultima data di modifica della risorsa.
Se la richiesta condizionale va a buon fine l'header
della risposta deve contenere almeno i campi Date, Content-Length
e Last-Modified correttamente determinati.
Altrimenti il corpo della risposta sara' vuoto e l'header
della risposta dovra' contenere soltanto Date e Last-Modified
Il server sara' in grado di gestire i seguenti casi
@nikiink
nikiink / UpsmonActionsScheduler.php
Last active August 29, 2015 14:22
Upsmon actions scheduler by eventlog. Start scheduled tasks based on the events logged on the eventlog file by Upsmon.
<?php
/*
PHPTail class from:
https://github.com/taktos/php-tail
https://code.google.com/p/php-tail/
*/
class PHPTail {
/**
* Location of the log file we're tailing
* @var string
<?php
function waitUntilPortIsListening($host, $port, $options = array('usleep' => 300000, 'limit' => 20)) {
$limit = array_key_exists('limit',$options)?$options['limit']:20;
$retries = 0;
while (true) {
$connection = @fsockopen($host, $port);
if (is_resource($connection)) {
echo "is listening\n";
@nikiink
nikiink / colornote2enex.php
Last active February 11, 2024 18:57
Export Enex file to be imported in Evernote from ColorNote db file colornote.db
<?php
# The file colornote.db is at this location:
# /data/data/com.socialnmobile.dictapps.notepad.color.note/databases/colornote.db
# this path is visible if your device is rooted and viewing as root with ES File Explorer for example
# see:
# https://nikiink.wordpress.com/2015/05/28/evernote-importing-from-lg-memo-and-from-colornote/
#
$db = new SQLite3("colornote.db");
$query = "SELECT * FROM notes";
@nikiink
nikiink / lgmemo2enex.php
Last active August 29, 2015 14:22
Export Enex file to be imported in Evernote from LG Memo db file richnote
<?php
# The lg memo db file richnote is at this location:
# /storage/sdcard0/Memo/backup.nrt
# this file is created after making a backup and this is a zip file,
# the file richnote is inside the zip
# see:
# https://nikiink.wordpress.com/2015/05/28/evernote-importing-from-lg-memo-and-from-colornote/
#
$db = new SQLite3("richnote");