Skip to content

Instantly share code, notes, and snippets.

@zyphlar
zyphlar / controller_test.php
Created September 10, 2014 22:49
phpunit test example
<?php
namespace Acme\Mybundle\Tests\Controller;
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Session\Session;
class ControllerTest extends WebTestCase
{
public function testVmplsNew() {
@zyphlar
zyphlar / cron.txt
Last active August 29, 2015 14:08
Amazon AWS EC2 snapshot cron job
# To set up these environment vars correctly, follow the instructions in:
# http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html
# this is necessary to load your AWS credentials from bashrc.
SHELL=/bin/bash
# double-check this and make sure it's the correct path for ec2-describe-volumes
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin
# this needs to be the path above, minus /bin
EC2_HOME=/opt/aws
# this also needs to be set/correctly
@zyphlar
zyphlar / .gitconfig
Created January 22, 2015 00:06
My gitconfig file
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
wdiff = diff --word-diff --color-words
[credential]
helper = cache --timeout=3600
[color]
diff = always
[diff]
@zyphlar
zyphlar / open_all_links.js
Created February 10, 2015 17:45
JQuery to open every link on a page due to laziness
@zyphlar
zyphlar / README.md
Last active August 29, 2015 14:23 — forked from oodavid/README.md

Deploy your site with git (improved with secret tokens, branches, and error output)

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
<?php
namespace Acme\YourBundle\Listener;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Bundle\TwigBundle\TwigEngine;
@zyphlar
zyphlar / Preferences.sublime-settings
Last active September 2, 2015 17:05
Binary and Folder exclude patterns for Symfony projects (and in general)
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
@zyphlar
zyphlar / ads.html
Created September 17, 2011 07:28
HeatSync Digital Signage
<html>
<head>
<style type="text/css">
body { background-color: #000; margin: 0;}
.adblock { display: block;
float: left;
width: 46%;
text-align: center;
height: 190px;
margin: 5px;
@zyphlar
zyphlar / logging.vbs
Created February 10, 2012 22:49
Login Logging Script
On Error Resume Next
'''Variables
Dim wsNetwork
Dim outUser
Dim outComputer
Dim outIP
Dim logPath
Dim septxt
@zyphlar
zyphlar / asterisk-status.php
Created February 29, 2012 19:18
Asterisk log monitoring
<?php
$output = array();
// This command finds the last 100 mentions of "Peer" in the log. Modify using your own keywords!
exec("grep Peer /var/log/asterisk/full | tail --lines=100", $output);
$output = array_reverse($output);
$today = date("M d");
$yesterday = date("M d",time()-86400);