Skip to content

Instantly share code, notes, and snippets.

View zachflower's full-sized avatar
💾

Zachary Flower zachflower

💾
View GitHub Profile
@zachflower
zachflower / tor_curl.php
Last active March 15, 2024 15:02
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@zachflower
zachflower / MY_Model.php
Created May 6, 2013 20:47
Custom CodeIgniter MY_Model
<?php
class MY_Model extends CI_Model{
/**
* The table name
*
* @var string
* @access protected
*/
protected $table = '';
@zachflower
zachflower / migration.php
Created August 13, 2013 01:01
CodeIgniter Migrations Config File
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default but should be enabled
| whenever you intend to do a schema migration.
|
*/
@zachflower
zachflower / 001_users.php
Created August 13, 2013 01:07
Example CodeIgniter Migration Script
<?php
class Migration_Users extends CI_Migration {
public function up(){
$this->dbforge->add_field("id int(11) unsigned NOT NULL AUTO_INCREMENT");
$this->dbforge->add_field("email varchar(255) NOT NULL DEFAULT ''");
$this->dbforge->add_field("password varchar(255) NOT NULL DEFAULT ''");
$this->dbforge->add_key('id', TRUE);
$this->dbforge->add_key('email');
@zachflower
zachflower / can.php
Last active December 28, 2015 20:28
PHP Authorization Class
<?php
/**
* PHP Authorization Class
*
* Authorization class for PHP.
* Usage Example:
* $can = new Can();
* $can->user = $user;
*
@zachflower
zachflower / tor.php
Last active December 28, 2015 20:29
Tor Page Crawler
<?php
/**
* Tor Page Crawler
*
* Download web pages anonymously using the Tor network.
* Usage Example:
* $tor = new Tor();
*
* $tor->setUrl('http://zacharyflower.com');
@zachflower
zachflower / todo.scpt
Last active August 29, 2015 14:01
Alfred AppleScript to add a new reminder to Apple's Reminders app
on alfred_script(q)
tell application "Reminders"
set nr to make new reminder
set name of nr to q
end tell
end alfred_script
@zachflower
zachflower / plexify.applescript
Last active August 29, 2015 14:02
AppleScript to migrate EyeTV recordings to Plex.
on run {input, parameters}
with timeout of (30 * 60) seconds
tell application "Finder"
repeat with anItem in the input
set parentFolder to container of anItem
set otherFiles to name of files in parentFolder
repeat with otherFile in the otherFiles
if otherFile ends with ".eyetvp" then
set xmlFile to (parentFolder as string) & ":" & otherFile
@zachflower
zachflower / LinkedList.class.php
Last active April 15, 2021 18:33
PHP implementation of a singly linked list.
<?php
class Node {
public $data = NULL;
public $next = NULL;
public function __construct($data = NULL) {
$this->data = $data;
}
}
@zachflower
zachflower / is_anagram.php
Created June 13, 2014 01:03
PHP function to determine whether or not two strings are anagrams.
<?php
function is_anagram($a, $b) {
return(count_chars($a, 1)==count_chars($b, 1));
}