Skip to content

Instantly share code, notes, and snippets.

@jimrubenstein
jimrubenstein / ami-to-ebs.sh
Created December 16, 2011 19:56 — forked from hubgit/ami-to-ebs.sh
creating an EBS AMI from a running Instance
# in web browser
# http://uec-images.ubuntu.com/releases/karmic/release/
# canonical karmic 64-bit AMI:
# ami-55739e3c
# canonical karmic 32-bit AMI:
# ami-bb709dd2
# https://console.aws.amazon.com/ec2/home#c=EC2&s=Instances
# Launch Instance > Community AMIs
#!/usr/bin/python
import os
import random
import time
os.system("osascript -e 'set volume 1' 2>/dev/null");
phrases = ("Help me, I'm stuck in here!", "Is anyone out there?", "Can anybody hear me?", "S O S", "It's dark in here..", "I'm watching you", "Please don't look at me like that", "Don't touch me there!", "What are you doing?", "Who are you?", "I know what you're typing...", "I wouldn't say that if I were you..")
voices = ("Zarvox", "Fred", "Ralph", "Victoria", "Princess", "Alex")
function getPageHistory() {
var hist = $.cookie('history');
try {
hist = JSON.parse(hist);
if (false == $.isArray(hist)) hist = [];
}
catch (e)
{
<div class="campaign-property-container">
<div class="campaign-property-value">
<? if ($Campaign->started()): ?>
<? if ($Campaign->running()): ?>
<span class="campaign-status mod-running">Running</span>
<? elseif ($Campaign->ended()): ?>
<span class="campaign-status mod-ended">Ended</span>
<? elseif ($Campaign->pending()): ?>
<span class="campaign-status mod-scheduled">Scheduled</span>
<? endif; ?>
<?php namespace App\Http\Middleware;
use Closure;
class NoCache {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
$ php callable_test.php
bool(false)
bool(true)
<?php
class Test {
public function __invoke() {}
}
var_dump(is_callable('Test'));
@jimrubenstein
jimrubenstein / gist:e68e4011ebd4f4850762
Last active August 29, 2015 14:16
make a closure out of a callable
function closureify(callable $fn)
{
return function() use ($fn) {
return call_user_func_array($fn, func_get_args());
};
}
$ mysql -e 'show slave status \G' -u root | grep "Running: No"
$ echo $?
1
$ mysql -e 'show slave status \G' -u root | grep "Running"
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
$ echo $?
0
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"app\\": "app/"
},
"files": [
"app/helpers/helpers.php"
]
var React= require('react/addons');
var Router = require('react-router');
var AppConstants = require('../../constants/AppConstants');
var GroupActionCreators = require('../../actions/GroupActionCreators');
var Link = Router.Link;
module.exports = React.createClass({
mixins: [Router.Navigation],