This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from base64 import b64decode | |
from json import loads | |
from pprint import pprint | |
def parse_celery_msg(msg): | |
pprint(loads(b64decode(msg))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ phpsh | |
Starting php | |
type 'h' or 'help' to see instructions & features | |
php> echo array('foo'=>'bar') === array('foo'=>'bar') | |
1 | |
php> echo array('foo'=>'baz') === array('foo'=>'bar') | |
php> echo array('foo'=>array(1)) === array('foo'=>array()) | |
php> echo array('foo'=>array(1)) === array('foo'=>array(1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, sys, os, subprocess | |
path = os.path.abspath(os.path.dirname(__file__)) | |
files = glob.glob('*/*.mkv') | |
ffmpeg = '/home/wes/ffmpeg-dmo-2.1.1/ffmpeg' | |
for f in files: | |
f = os.path.join(path, f).replace(' ', '\\ ').replace('(', '\(').replace(')', '\)').replace('&', '\&').replace(';', '\;') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def header(content, depth=1, underline=False): | |
if underline: | |
char = ('=', '-', '*')[(depth if depth < 4 else 3)] | |
return "{0}\n{1}".format(content, (char * len(content))) | |
return "{0} {1}".format(('#' * depth), content) | |
def quote(content, prefix='> '): | |
return "\n".join("> {0}".format(c) for c in content.split("\n")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import env, task, run, sudo, cd, local | |
from fabric.decorators import with_settings | |
from fabric.operations import put | |
env.user = 'ec2-user' | |
env.hosts = [ | |
'ec2-your-address-1.us-west-2.compute.amazonaws.com', | |
'ec2-your-address-2.us-west-2.compute.amazonaws.com', | |
'ec2-your-address-3.us-west-2.compute.amazonaws.com', | |
'ec2-your-address-4.us-west-2.compute.amazonaws.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var macLeRe = /\r[^\n]/, | |
winLeRe = /\r\n/, | |
posixLeRe = /[^\r]\n/; | |
function detectLineEnding(str) { | |
var type = 'unknown'; | |
if (winLeRe.test(str)) { | |
type = 'windows'; | |
} else if (macLeRe.test(str)) { | |
type = 'mac'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$storm_subscribers = file(dirname(__FILE__) . '/phpstorm.txt'); | |
$storm_winner = $storm_subscribers[array_rand($storm_subscribers)]; | |
$signals_subscribers = file(dirname(__FILE__) . '/signalsebook.txt'); | |
$i = array_rand($signals_subscribers); | |
$signals_winners = array( | |
$signals_subscribers[$i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This is the most common form of implementing a callable map in Python, | |
using a dict that names each callable. | |
However as you can it means effectively defining names in several places | |
when you need more than a simple lambda for your callable, due to Python | |
not having first class anonymous functions. | |
example: python 1_dict_hashmap.py complex | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An error occurred while executing `vmrun`, a utility for controlling | |
VMware machines. The command and output are below: | |
Command: ["start", "/Users/wes/projects/serverdensity/Vagrantfiles/honshuu-environment/.vagrant/machines/default/vmware_fusion/vm.vmwarevm/precise64.vmx", "nogui", {:notify=>[:stdout, :stderr]}] | |
Stdout: 2013-07-22T07:48:28.125| ServiceImpl_Opener: PID 98149 | |
Error: The operation was canceled | |
Stderr: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Getting distribution for 'buildout.dumppickedversions==0.5'. | |
While: | |
Installing. | |
Loading extensions. | |
Getting distribution for 'buildout.dumppickedversions==0.5'. | |
Error: Couldn't find a distribution for 'buildout.dumppickedversions==0.5'. |