This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
[[ -z $1 ]] && echo "Please provide source directory" && exit -1 | |
SOURCE=$1 | |
DSTDIR=${SOURCE}.size | |
FILES=$(find $SOURCE -type f -not -user root -print | tr "\n" ",") | |
gen_file_size() { | |
SRCFILE="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install -y git-core curl libfreetype6 libfontconfig | |
RUN curl -LO https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 | |
RUN tar xjfv phantomjs-1.9.7-linux-x86_64.tar.bz2 -C /usr/local/ | |
RUN ln -sf /usr/local/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs | |
RUN git clone https://github.com/n1k0/casperjs.git /usr/local/casperjs | |
RUN ln -sf /usr/local/casperjs/bin/casperjs /usr/local/bin/casperjs | |
RUN rm -f phantomjs-1.9.7-linux-x86_64.tar.bz2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cs = require("casper").create({ | |
verbose: true, | |
logLevel: 'debug' | |
}); | |
myUsername = cs.cli.has("username") ? cs.cli.get("username") : ""; | |
myPassword = cs.cli.has("password") ? cs.cli.get("password") : ""; | |
cs.start("https://twitter.com", function() { | |
if (this.exists('div.front-signin.js-front-signin')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Numlet{ | |
protected $fizz = false; | |
protected $buzz = false; | |
public function isFizz($n) { | |
if ($n % 3 == 0) { | |
$this->fizz = true; | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php redisTest.php | |
Keyword: free+book, score:736764 | |
Keyword: pretty+picture, score:117600 | |
Keyword: best+seller, score:411600 | |
Keyword: stuff, score:2998800 | |
Keyword: bedok, score:29400 | |
Keyword: best+seller+free+book, score:176400 | |
Keyword: best+seller, score:411600 | |
Keyword: best+seller, score:411600 | |
Keyword: free+book, score:736764 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TO=/path/to/backups | |
FROM=/home/foo/webroot/awesome_website | |
now=`date +"%F"` | |
NUM_TO_KEEP=3 # How many artefacts do you want to keep | |
[ -e /$TO/$now/backup_yes ] && echo "Already backup today" && exit 0 | |
cd $TO | |
export NUM_TOTAL=`find . -maxdepth 1 -type d | grep '^./' | wc -l` | |
export NUM_TO_DEL=`expr $NUM_TOTAL - $NUM_TO_KEEP` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casper.evaluate(function triggerKeyDownEvent() { | |
var e = jQuery.Event("keydown"); | |
e.which = 13; | |
e.keyCode = 13; | |
jQuery("#questions_holder .question:nth-child(1) .txt-inline-answer").trigger(e); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Put it in App/Provider | |
*/ | |
namespace App\Provider; | |
use Silex\Application; | |
use Silex\ControllerProviderInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Author: Dwi Sasongko S <[email protected]> | |
* See: http://www.phpactiverecord.org/projects/main/wiki/Quick_Start | |
*/ | |
namespace App\Provider; | |
use Silex\Application; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh | |
# chmod +x install_python.sh | |
# ./install_python.sh | |
#!/bin/sh | |
echo "******************************************" | |
echo "Configure Centos box with a recent version" | |
echo "of Python. " | |
echo " - jgumbley 12/jan/11" |
NewerOlder