Skip to content

Instantly share code, notes, and snippets.

@webjay
webjay / php-fpm.xml
Created March 26, 2011 17:14
PHP-FPM Solaris Service Management Facility
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="php-fpm">
<service name="network/php-fpm" type="service" version="1">
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='network/nginx' type='service' version='0'>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
@webjay
webjay / pear-install
Created July 6, 2011 07:30
Howto install Pear onaMac
cd /tmp
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
# change installation directory to /usr/local
sudo pear update-channels
@webjay
webjay / jobs
Created October 9, 2011 20:18
A JavaScript singleton object to handle asynchronous jobs.
/**
* A JavaScript singleton object to handle asynchronous jobs.
* Give it a callback to i.e. know when to close the database connection.
* @author Jacob Friis Saxberg
*/
module.exports = new function () {
this.debug = true;
var jobs = 0;
@webjay
webjay / nodejs-meet-mongo.js
Created October 23, 2011 19:41
How to connect to MongoDB from Node.js
var mongodb = require('mongodb');
var server = new mongodb.Server('hostname', portnumber, {auto_reconnect: true});
var db = new mongodb.Db('databasename', server);
db.open(function (err, db) {
if (err) {
console.error(err);
} else {
db.authenticate('username', 'password', function(){
@webjay
webjay / gist:2145895
Created March 21, 2012 10:00
jitsu deploy output
$ jitsu deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in server.js
warn: Local version appears to be old.
warn: Your package.json version will be incremented for you automatically.
warn: About to write /Users/jacob/Sites/test/package.json
data:
data: {
@webjay
webjay / server-info.html
Created June 18, 2012 22:00
Apache Server Information
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Server Information</title>
</head>
<body><h1 style="text-align:center">Apache Server Information</h1>
<dl><dt><tt>Subpages:<br/><a href="?config">Configuration Files</a>, <a href="?server">Server Settings</a>, <a href="?list">Module List</a>, <a href="?hooks">Active Hooks</a></tt></dt></dl><hr/><dl><dt><tt>Sections:<br/><a href="#server">Server Settings</a>, <a href="#startup_hooks">Startup Hooks</a>, <a href="#request_hooks">Request Hooks</a></tt></dt></dl><hr/><dl><dt><tt>Loaded Modules: <br/><a href="#mod_ssl.c">mod_ssl.c</a>, <a href="#mod_php5.c">mod_php5.c</a>, <a href="#mod_instaweb.cc">mod_instaweb.cc</a>, <a href="#mod_version.c">mod_version.c</a>, <a href="#mod_rewrite.c">mod_rewrite.c</a>, <a href="#mod_alias.c">mod_alias.c</a>, <a href="#mod_dir.c">mod_dir.c</a>, <a href="#mod_info.c">mod_info.c</a>, <a href="#mod_mime.c
@webjay
webjay / extinguisher.rb
Created August 9, 2012 20:49
Clean a Campfire room of uploads
require 'rubygems'
require 'tinder'
# You need to put your *.campfirenow.com cookies in a cookies.txt file
class CampfireUploadCleaner
CF_DOMAIN = ''
CF_ROOM = ''
CF_TOKEN = ''
@webjay
webjay / gh_hook.php
Last active January 7, 2023 11:54
Php hook script that can git pull, apc_clear_cache() etc
<?php
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
2 => array('pipe', 'w') // stderr
@webjay
webjay / gist:4546859
Last active December 11, 2015 04:39
Delete all sub directories named "migrations". Handy for Django South clearance https://groups.google.com/d/msg/south-users/iIQT8ZWs2cI/GQ4kONoT5Q4J
find * -type d -name migrations -print0 | xargs -0 -I {} rm -rf "{}"