Skip to content

Instantly share code, notes, and snippets.

View cjsewell's full-sized avatar

Corey Sewell cjsewell

  • Jucy Group
  • New Zealand
View GitHub Profile
@cjsewell
cjsewell / runphar.bat
Last active August 29, 2015 14:08
Simple PHP PHAR wrapper for windows and linux
@ECHO OFF
REM Simple wrapper for PHP PHAR files for Windows command line
REM Executes a phar file in a with the same name as this script in a subfolder named phars
REM Eg. Calling this script c:\tools\runphar.bat will execute "php c:\tools\phars\runphar.phar"
SET BASE_DIR=%~dp0
SET SCRIPT_NAME=%~n0
SET PHAR=%BASE_DIR%phars\%SCRIPT_NAME%.phar
SET PHP=php
@cjsewell
cjsewell / findPHP
Created November 9, 2014 08:05
PHP function to try and find the php executable on the current system. Kind of redundant now 5.4 has PHP_BINARY, but this is good for backwards compatibility
function findPHP() {
if (defined('PHP_BINARY') && is_executable(PHP_BINARY)) {
$res = PHP_BINARY;
} else {
$which = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'where' : 'which';
$outputArr = [];
$whichReturn = false;
$res = exec($which . " php 2>&1", $outputArr, $whichReturn);
if ($whichReturn !== 0) {
$res = false;
@cjsewell
cjsewell / createCopy.php
Last active August 29, 2015 14:09
Simple php script to grab a copy of a site and database
<?php
ini_set('display_errors', 'On');
$siteArchive = $_SERVER['DOCUMENT_ROOT'] . "/site.tar.gz";
$dbDump = $_SERVER['DOCUMENT_ROOT'] . "/dump.sql";
$outputeArchive = array();
$return_varArchive = 99;
$outputDump = array();
$return_varDump = 99;
error_reporting(E_ALL);
@cjsewell
cjsewell / gist:d5e8334fe4bb156fb6fc
Created November 21, 2014 00:40
Disabling screen blanking gnome 3
export $DISPLAY=:0;
gsettings get org.gnome.desktop.screensaver lock-delay;
gsettings get org.gnome.desktop.session idle-delay;
dbus-launch gsettings set org.gnome.desktop.screensaver lock-delay 0;
dbus-launch gsettings set org.gnome.desktop.session idle-delay 0;
git clone https://github.com/lavi741/gnome-shell-extension-inhibit-suspend /tmp/inhibit-suspend;
mv /tmp/inhibit-suspend/inhibit-suspend@lavi.a ~/.local/share/gnome-shell/extensions/test
dbus-launch gsettings set org.gnome.shell enabled-extensions "['inhibit-suspend@lavi.a']";
@cjsewell
cjsewell / app\Http\Controllers\WelcomeController.php
Created February 17, 2015 08:19
ispconfig-soap-client Larval test
<?php
namespace App\Http\Controllers;
class WelcomeController extends Controller {
/*
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
@cjsewell
cjsewell / breakpoints
Created February 25, 2015 01:44
Boostrap sass break points
div{
@media (min-width: $screen-xs) { // Mobile portrait < 480px
border: 1px solid yellow;
}
@media (min-width: $screen-sm-min) { // Mobile landscape / Tablet portrait < 768px
border: 1px solid green;
}
@media (min-width: $screen-md-min) { // Tablet landscape < 992px
@cjsewell
cjsewell / traffic.sh
Last active October 16, 2023 09:51 — forked from radu-gheorghe/traffic.sh
#!/bin/bash
#shows traffic on the specified device
function human_readable {
VALUE=$1
BIGGIFIERS=( B K M G )
CURRENT_BIGGIFIER=0
while [ $VALUE -gt 10000 ] ;do
VALUE=$(($VALUE/1000))
@cjsewell
cjsewell / netspeed.sh
Last active May 23, 2018 16:28
netspeed.sh
#!/bin/bash
#shows speed on the specified device
###CHECKS####
DEVICE=$1
IS_GOOD=0
for GOOD_DEVICE in `grep ":" /proc/net/dev | awk '{print $1}' | sed s/:.*//`; do
@cjsewell
cjsewell / sass.bat
Last active September 15, 2015 10:48
Simple wrapper script to allow Netbeans to use node sass.
@ECHO OFF
SET RUBY="c:\tools\ruby200\bin\ruby.exe"
SET NODE=C:\ProgramData\chocolatey\bin\node.exe
SET RUBY_SASS="c:/tools/ruby200/bin/sass"
SET NODE_SASS=node_modules\node-sass\bin\node-sass
SET WT_SASS=wt.exe
SET ARG1=%1
SET ARG2=%2
SET ARG3=%3
SET ARG4=%4
@cjsewell
cjsewell / InstallCss3FontConverter .sh
Created September 16, 2015 00:23
Install css3FontConverter Ubuntu
apt-get install woff-tools
apt-get install fontforge
cd /usr/local/src/
git clone --recursive https://github.com/google/woff2.git
cd woff2
make clean all
ln -s /usr/local/src/woff2/woff2_* /usr/local/bin/
cd..
git clone https://github.com/zoltan-dulac/css3FontConverter.git