Skip to content

Instantly share code, notes, and snippets.

View druid628's full-sized avatar

Micah Breedlove druid628

View GitHub Profile
@h4cc
h4cc / architecture.php
Created August 23, 2013 11:56
Check if PHP is running on a 32bit or 64bit architecture.
<?php
// Switch architecture if needed
if(2147483647 == PHP_INT_MAX) {
$architecture = 'i386';
}else{
$architecture = 'amd64';
}
@JoshuaEstes
JoshuaEstes / DefaultControllerTest.php
Created October 4, 2012 16:38
Create a symfony test client that is authenticated
<?php
namespace Acme\BlogBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
class PID(object) :
def __init__(self, temp_probe, target) :
self.temp_probe = temp_probe
self.samples = []
self.target = target
GPIO.setup(CHILLPIN, GPIO.OUT)
self.pid_ts = None
self.events = []
GPIO.output(CHILLPIN, False)
@JoshuaEstes
JoshuaEstes / user.sh
Last active October 10, 2015 07:57
Script to create a deployment user on a linux box
# Remote Server
useradd www-deploy -c "Deployment User" -d /home/www-deploy -G www-data -m -s /bin/bash
sudo su - www-deploy
# Localhost
ssh-keygen -t rsa
# Append your key to the Remote host authorized keys file
cat id_rsa.pub >> ~/.ssh/authorized_keys
@ziadoz
ziadoz / awesome-php.md
Last active May 8, 2025 07:37
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@JoshuaEstes
JoshuaEstes / search_and_replace.pl
Created December 13, 2011 17:29
command line function to search and replace text
perl -p -i -e 's/oldstring/newstring/g' `find ./ -name "*.html"`
@JoshuaEstes
JoshuaEstes / moduleActionsTest.php
Created October 21, 2011 16:16
Test template for a symfony 1.4 admin generated action
<?php
/**
* Symfony admin generator test template
* @see https://gist.github.com/1304240
*/
/**
* The model name
*/
$model = 'ModelName';
@epochblue
epochblue / lookbusy.py
Created April 19, 2011 18:52
Just tell 'em you're seeding the search index...
#!/usr/bin/env python -tt
import time
import random
OMGBUSY = """
>> execute: Splitting up dataset, running from {0} to {1}
>> routingPattern Connect route "taggable_add_tag" (/admin/addTag/:object_class/:object_id)
>> routingPattern Connect route "taggable_remove_tag" (/admin/removeTag/:object_class/:object_id)
>> routingPattern Connect route "prestaSitemap_index" (/sitemap.xml)
@Daniel15
Daniel15 / 1_Twitter autoresponder bot.md
Last active December 6, 2021 20:37
Twitter autoresponder bot

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1

@hubgit
hubgit / twitter-oauth-pecl.php
Created May 20, 2010 17:58
Command line Twitter OAuth authentication in PHP
<?php
// Register an app: http://dev.twitter.com/apps
define('CONSUMER_KEY', 'YOUR CONSUMER KEY');
define('CONSUMER_SECRET', 'YOUR CONSUMER SECRET');
define('TWITTER_TOKEN', '');
define('TWITTER_TOKEN_SECRET', '');
$oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);