Skip to content

Instantly share code, notes, and snippets.

View till's full-sized avatar
💀
writing yaml

Till! till

💀
writing yaml
View GitHub Profile
@till
till / gist:819877
Created February 10, 2011 03:25
Looked at Question2Answer the other day. This was one of the more funny bits.
<?php
function qa_db_connection()
/*
Return the current connection to the QA database, if any
*/
{
global $qa_db;
return $qa_db;
}
@till
till / gist:820624
Created February 10, 2011 14:41
mail-flag.phpt
--TEST--
mail(): returns false when sendmail_path contains a -f flag and we use additional_params with one
--INI--
sendmail_path=/usr/sbin/sendmail -t -i -f [email protected]
--FILE--
<?php
var_dump(mail('[email protected]', 'subject', 'message', 'From: [email protected]', '[email protected]'));
?>
--EXPECT--
bool(true)
@till
till / gist:871440
Created March 15, 2011 20:43
go-pear example
till@till-laptop:~$ wget http://pear.php.net/go-pear.phar
--2011-03-15 21:43:06-- http://pear.php.net/go-pear.phar
Resolving pear.php.net... 78.129.214.25
Connecting to pear.php.net|78.129.214.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3678173 (3.5M) [application/octet-stream]
Saving to: `go-pear.phar'
100%[===================================================================================>] 3,678,173 1.10M/s in 3.2s
root@till:~# su couchdb -c "/usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5"
This account is currently not available.
root@till:~# cat /etc/passwd|grep couchdb
couchdb:x:1001:1001:,,,:/usr/local/var/lib/couchdb:/usr/sbin/nologin
root@till:~# usermod -s /bin/bash couchdb
root@till:~# su couchdb -c "/usr/local/bin/couchdb -b -o /dev/null -e /dev/null -r 5"
Apache CouchDB has started, time to relax.
<% @entries.each do |ip, host| %>
<%= "#{ip} #{host}" %>
<% end %>
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@till
till / replacement-checker.php
Created April 11, 2011 16:59
replacement-checker.php
<?php
if ('@@data_dir@@' == '@@' . 'data_dir@@') {
// in a checkout, or people didn't use pear to install the package
}
?>
@till
till / gist:1019108
Created June 10, 2011 15:48
vagrant error
[default] Destroying VM and associated drives...
/opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:93:in `send': undefined method `status' for nil:NilClass (NoMethodError)
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:93:in `spec_to_proc'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:32:in `call'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:32:in `load_interface_attribute'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:13:in `load_interface_attributes'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:12:in `each'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/virtualbox-0.8.6/lib/virtualbox/abstract_model/interface_attributes.rb:12:
<?php
class CouchDB
{
/**
* @param string $id
*
* @return stdClass
*/
public function getDocument($id)
{
<?php
require_once __DIR__ . '/silex.phar';
require_once 'phar://' . __DIR__ . '/silex.phar/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->register();