Skip to content

Instantly share code, notes, and snippets.

View rafi's full-sized avatar

Rafael Bodill rafi

View GitHub Profile
@rafi
rafi / gmail_spam_filter.md
Created December 4, 2009 10:37
Gmail spam filter

I'm sick of all those spam emails sent to my Gmail, although they are trapped in the Spam folder, sometimes I do receive legitimate emails which are mistakenly trapped in the spam folder, so this filter will delete annoying pharmaceuticals shit and crap watches spam emails so looking at the spam will be a little easier.

Subject: Pfizer OR RxMed OR RxMeds OR Ritalin OR Phentermin OR AnxietyMedications OR Weightl0ss OR Vicodin OR Oxycodone OR noprescription OR hydrocodone OR "Herbal Pills" OR ("risk free" AND pills) OR "longer and stronger in bed" OR "help falling in sleep" OR "unique web offer" OR (without AND prescription) OR (fda AND drugs) OR "refill notice" OR (long AND stronger AND bed) OR ((favorite OR pain OR cheaper OR online OR refill OR order) AND (medication OR medications OR med OR meds)) OR Xanax OR Viagra OR Phentermine OR RxMedications OR (Refill AND PreScript) OR (Replica AND Watches) OR (Percocet AND (Shipped OR Available)) OR (larger AND penis) OR Phentrmine OR Cialis

Has the words:

@rafi
rafi / post-receive
Created March 25, 2010 19:34
Deploying with Git
mkdir ~/git/website.git && ~/git/cd website.git
git init --bare
mkdir ~/webapps/website
git config core.bare false
git config core.worktree /home/rafi/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
git config receive.denycurrentbranch ignore
; create a hook
cat > hooks/post-receive
#!/bin/sh
@rafi
rafi / gource-commands.txt
Created April 14, 2010 15:26 — forked from alkavan/gource-commands.txt
Gource command
################################
gource commands
################################
# basic command for big and long projects
gource --max-user-speed 500 --seconds-per-day 0.05 --file-idle-time 10 -e 0.005 -f --max-files 300 --hide-files
# some easy to understand commands
# for output file
--output-ppm-stream ~/ppm/ppm-kohana
@rafi
rafi / MongoDB install
Created April 14, 2010 20:56
MongoDB install
wget http://downloads.mongodb.org/linux/mong … -1.2.0.tgz
tar xvfz mongodb-linux-i686-1.2.0.tgz -C /usr/local/softnix/
mv mongodb-linux-i686-1.2.0/ mongodb
mkdir -p /data/db
ln -s /usr/local/softnix/mongodb/bin/mongod /sbin/mongod
ln -s /usr/local/softnix/mongodb/bin/mongo /bin/mongo
./mongod &
./mongo
@rafi
rafi / tree.php
Created April 15, 2010 10:33 — forked from shadowhand/tree.php
Tree view
<?php
$depth = 0;
echo '<ol class="tree">';
foreach ($children as $i => $child)
{
// Get the last and next nodes
$last = isset($children[$i-1]) ? $children[$i-1] : $children[0];
$next = isset($children[$i+1]) ? $children[$i+1] : $children[0];
diff --git a/classes/kohana/exception.php b/classes/kohana/exception.php
index 7952a7b..657f661 100644
--- a/classes/kohana/exception.php
+++ b/classes/kohana/exception.php
@@ -23,6 +23,8 @@ class Kohana_Exception extends Exception {
*/
public function __construct($message, array $variables = NULL, $code = 0)
{
+ $variables = array_map(array('HTML', 'chars'), $variables);
+
# Changing all files dates recursively
find . -exec touch -t 201005050900 {} \;
@rafi
rafi / json.php
Created June 12, 2011 20:03 — forked from alkavan/json.php
JSON Helper for Kohana v3.x
<?php defined('SYSPATH') or die('No direct script access.');
/**
* JSON helper class
*
* Examples:
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded
*
* @package Kohana
@rafi
rafi / model
Created November 21, 2011 15:00
validation: model related with other models
class Model_Core_Account extends Abstract_Model_Base {
public $list_fields = array();
public function check()
{
// validate list fields if exist, here!
// call parent model validation
return parent::check();
@rafi
rafi / gist:4626560
Created January 24, 2013 19:08
lightdm display setup
#!/bin/bash
# V-1.0 by Hanynowsky - April 2012.
# I am a very basic script that works around bug 874241 repprted in launchpad.
XCOM0=`xrandr -q | grep 'HDMI1 connected'`
XCOM1=`xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1`
XCOM2=`xrandr --output LVDS1 --mode 1366x768`
# if the external monitor is connected, then we tell XRANDR to set up an extended desktop
if [ -n "$XCOM0" ] || [ ! "$XCOM0" = "" ]; then echo $XCOM1
# if the external monitor is disconnected, then we tell XRANDR to output only to the laptop screen