Skip to content

Instantly share code, notes, and snippets.

@maid450
maid450 / NodeCreationObserver.js
Created March 31, 2016 06:40
Node creation observer
/*
source: https://openuserjs.org/libs/soufianesakhi/node-creation-observer
Use cases
1: Apply a callback each time a type of node is created
Fire a callback each time an element that matches the selector is created.
Don't apply the callback for the same element multiple times.
In this case, the removeOnFirstMatch property should be set to false.
2: Wait for the creation of one node and apply a callback
// ----------------------------------------------------------------------------------------------------
// - Display Errors
// ----------------------------------------------------------------------------------------------------
ini_set('display_errors', 'On');
ini_set('html_errors', 0);
// ----------------------------------------------------------------------------------------------------
// - Error Reporting
// ----------------------------------------------------------------------------------------------------
error_reporting(-1);
@maid450
maid450 / sshput.sh
Created April 16, 2012 06:56
Setup auto ssh login based on DSA public key
#!/bin/sh
# sshput <remotehost>
#
# Puts your local DSA public key into the .ssh/authorized_keys
# on a remote machine. This should allow you to login without
# needing a password.
#
# This software comes with no guarantees whatsoever, and is yours to
# do with as you will. I'd be grateful if you feed any generally-useful
# improvements back to me, for the benefit of others.
@maid450
maid450 / fakemail.py
Created February 22, 2012 20:43
Fake SMTP "server" that captures and saves to disk all emails. For testing purposes
#!/usr/bin/env python
#
# fakemail (Python version)
#
# $Id: fakemail.py,v 1.1 2005/08/29 22:04:55 lastcraft Exp $
import asyncore
import getopt
import os
@maid450
maid450 / rsync_download.sh
Created February 19, 2012 12:26
Script to download through rsync with retries
#!/bin/bash
#TODO option to set --include patterns
### ABOUT
### Runs rsync, retrying on errors up to a maximum number of tries.
### Simply edit the rsync line in the script to whatever parameters you need.
# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit;" SIGINT SIGTERM
@maid450
maid450 / Kohana 3.X auth snippets.php
Last active March 21, 2016 00:08
Kohana 3.X auth snippets
<?php
//Useful code snippets
//Here are some code snippets which show you the basics of Auth:
//Create a new user (e.g. if you have not set up any users yet and want to do that programmatically)
$model = ORM::factory('user');
$model->values(array(
'username' => 'admin',
'email' => '[email protected]',
'password' => 'admin',