Skip to content

Instantly share code, notes, and snippets.

View Caffe1neAdd1ct's full-sized avatar
💻
Working on multiple projects

Kevin Andrews Caffe1neAdd1ct

💻
Working on multiple projects
View GitHub Profile
@Caffe1neAdd1ct
Caffe1neAdd1ct / phpunit-netbeans-debug
Created February 6, 2014 01:46
phpunit netbeans debug custom script
#!/usr/bin/env php
<?php
putenv("XDEBUG_CONFIG=idekey=netbeans-xdebug");
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
if (strpos('/usr/bin/php', '@php_bin') === 0) {
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
} else {
@Caffe1neAdd1ct
Caffe1neAdd1ct / phpunit-sendmail-trapmail
Created February 6, 2014 11:32
Change sendmail path to a trapmail when running phpunit
#!/usr/bin/env php
<?php
/** Build arg string */
if(isset($argv)) {
/** Remove original phpunit script call argument */
unset($argv[0]);
/** Build arguments into a string */
@Caffe1neAdd1ct
Caffe1neAdd1ct / trapmail
Created February 6, 2014 11:37
Stop live emails going out via sendmail
#!/bin/bash
formail -R cc X-original-cc \
-R to X-original-to \
-R bcc X-original-bcc \
-f -A"To: [email protected]" \
| /usr/sbin/sendmail -t -i
# pipe all to a log instead, comment out formail code
#tee -a /tmp/trapmail.log > /dev/null
@Caffe1neAdd1ct
Caffe1neAdd1ct / php-zip-uncompressed-size
Last active December 14, 2015 10:37
Find total uncompressed size of a zip archive
#!/usr/bin/env php
<?php
$zip = new ZipArchive();
if ($zip->open('name.zip') === true) {
var_dump(getTotalUncompressedSize($zip));
$zip->close();
}
@Caffe1neAdd1ct
Caffe1neAdd1ct / jekyll-posts-by-year-bootstrap
Last active August 29, 2015 14:05
Listing jekyll posts using liquid grouped by year then month
---
layout: page
sitemap:
priority: 0.7
changefreq: monthly
lastmod: 2014-08-01T15:06:00
---
<div class="row-fluid">
<div class="span12 padded">
@Caffe1neAdd1ct
Caffe1neAdd1ct / shellshock-tester.sh
Last active August 29, 2015 14:06
Bash CVE shellshock testing script
#!/bin/bash
INJECTION="All your bash"
OUTPUT=$(env x='() { :;}; echo '"$INJECTION"'' bash -c "echo are belong to us." 2>&1);
if [[ $OUTPUT == *"$INJECTION"* ]]
then
echo -e "WARNING THIS SERVER IS VULNERABLE - UPDATE BASH NOW."
else
echo -e "All clear you can relax!";
@Caffe1neAdd1ct
Caffe1neAdd1ct / poodle-bleed-tester.sh
Created October 15, 2014 13:51
Test script for SSLv3 Poodle Bug
#!/bin/bash
HOST=$1
PORT=$2
INJECTION="sslv3 alert handshake failure"
OUTPUT=$(openssl s_client -connect $HOST:$PORT -ssl3 2>&1);
FAILED="connect:errno"
if [[ $OUTPUT == *"$INJECTION"* ]]
@Caffe1neAdd1ct
Caffe1neAdd1ct / phpci.yml
Created February 17, 2015 17:10
PHPCI Config for Zend Framework 1 Projects With Composer Enabled
build_settings:
ignore:
- "vendor"
- "tests"
setup:
composer:
action: "install --no-dev"
#!/bin/bash
if [ ! "$#" -eq 1 ]; then
echo "Usage: sudo $0 VIRTUAL_HOST_NAME"
exit
fi
if [ ! $(whoami) = "root" ]; then
echo "You require root privilages for server maintanence, use sudo?"
exit
@Caffe1neAdd1ct
Caffe1neAdd1ct / jekyll-watch.sh
Created August 12, 2015 21:05
Jekyll Watcher For Netbeans Projects
#!/bin/zsh
if [ -z "$1" ]
then
echo "Please specify the project you wish to watch with jekyll watch e.g ./Scripts/jekyll-blog projectname"
else
cd ~/Software/Jekyll/
nohup ~/.rbenv/shims/bundle exec jekyll build --source ~/NetBeansProjects/$1/ --destination ~/NetBeansProjects/$1/_site --watch 1>&2 &
fi