Skip to content

Instantly share code, notes, and snippets.

View arnold-almeida's full-sized avatar
💀
Based

Arnold A arnold-almeida

💀
Based
View GitHub Profile
@arnold-almeida
arnold-almeida / dir_mon
Created November 14, 2010 02:31
Monitor files in a directory, do stuff when contents change.
#!/bin/sh
# Via http://www.unix.com/shell-programming-scripting/100979-folder-watch.html
DIR=foo
STATIC=contents
ls -al $DIR > contents.tmp
diff -q contents.tmp $STATIC
if [ ! $? -eq 0 ]
@arnold-almeida
arnold-almeida / symlinks->hardlinks
Created October 10, 2010 12:08
Convert symlinks to hard links in a dir
@arnold-almeida
arnold-almeida / Files changed since last tag
Created October 14, 2009 04:43
GIT: Files changed since last tag
#!/bin/bash
unset GIT_DIR
cd /path/to/project
# Get our info....
LATEST_TAG=$(git describe --tags --abbrev=0)
CURRENT_REVISION=$(git describe)
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l)
#FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG)
function request($data , $retry = 1)
{
//Configure::write('debug' , 2);
$start_time_unix = time();
$max_time_unix = time() + $this->request_timeout;
$success = false;
// Are there any servers left to try ???
if(false != $this->select_server())
/**
* @param $file Path to source file
* @param $dest Path to save the image
* @param $type Method of resizing ('resize', 'resizemin', 'resizecrop', 'crop')
* @param $size Dimensions, array of width and height or maxScale
* @param $output Type of file to save it as ('jpg', 'png', 'gif')
* @param $quality 0 < x < 100
*/
function image ($file, $dest, $type, $size, $output = NULL, $quality = NULL, &$error = '') {