Skip to content

Instantly share code, notes, and snippets.

<?php
// Clean argument values
$phpStormRunner = null;
$cleanedArgv = array();
foreach ($_SERVER['argv'] as $key => $value) {
if (strpos($value, 'ide-phpunit.php') === false) {
$cleanedArgv[] = $value;
} else {
$phpStormRunner = $value;
}
@TomA-R
TomA-R / bongo.sh
Last active December 24, 2015 10:59 — forked from jmoiron/bongo.sh
#!/bin/bash
LOADING=false
while [ $# -gt 0 ] ; do
case "$1" in
-h|--help)
echo "usage: $package [options] dbname"
echo " "
echo "OPTIONS:"
<?php
chdir('..');
$output = array();
exec('git log -15 --pretty=format:"%ad %an %s" --abbrev-commit --date=short', $output);
$history = array();
foreach ($output as $line) {
$commit = array();
# Serve .vtt files with Access-Control-Allow-Origin: * header if referer is the correct domain
<IfModule mod_setenvif.c>
<FilesMatch "\.vtt$">
SetEnvIf Referer "^http(s)?://(.+\.)?somedomain\.com/" VALID_REFERER=$1
Header set Access-Control-Allow-Origin "*" env=VALID_REFERER
</FilesMatch>
</IfModule>
You could also use origin
1 x Uno R3 board +1 x USB cable
1 x Uno R3 Extension baord + 1 x GPIO Extension Board + 1 x Connecting Cable
1 x Breadboard
1 x Mini Breadboard
10 x 3mm Red LEDs
10 x 3mm Green LEDs
10 x 3mm Yellow LEDs
1 x 5mm RGB LED
5 x Button
20 x (330 ohm + 1k ohm +10k ohm)resistor
@TomA-R
TomA-R / ec2-instance-subnet-id.md
Created November 15, 2017 05:02 — forked from samkeen/ec2-instance-subnet-id.md
Get the subnet and VPC id of a running EC2 instance

First get the Interface mac address, then use that to run the full command

INTERFACE=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/)
SUBNET_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/subnet-id)
VPC_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/vpc-id)

echo $SUBNET_ID
#!/bin/sh
#
# beanstalkd - a simple, fast workqueue service
#
# chkconfig: - 57 47
# description: a simple, fast workqueue service
# processname: beanstalkd
# config: /etc/sysconfig/beanstalkd
#
@TomA-R
TomA-R / packer-iam-policy.json
Created April 12, 2018 06:02
Packer Amazon AWS IAM policy permission document
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AttachVolume",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CopyImage",
"ec2:CreateImage",
@TomA-R
TomA-R / install-redis.sh
Last active May 9, 2018 01:09
Install Redis stable
#!/bin/bash
# Dependencies
yum install -y tcl
# Download and extract source code
cd /usr/local/src
wget http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
rm -f redis-stable.tar.gz
@TomA-R
TomA-R / getinstances.py
Created July 12, 2018 07:55
Print EC2 instances by tag value
#!/usr/bin/python
# Used on bastion host (jumpbox)
# e.g.: for feedserver in $(/usr/bin/getinstances feed-server); do echo $feedserver; ssh $feedserver; done;
# @todo: make VPC detection automatic
import sys
import json
import subprocess