Skip to content

Instantly share code, notes, and snippets.

View derak-kilgo's full-sized avatar

Derak Kilgo derak-kilgo

View GitHub Profile
#!/bin/bash
# Make sure only root can run our script
FILE="/tmp/out.$$"
GREP="/bin/grep"
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@derak-kilgo
derak-kilgo / magento-1x-reset.php
Created February 21, 2017 18:35
A php script to remove all orders and products from a magento 1.x instance, clear the cache and update core_config. Keeps users, customers, product categories and system settings intact.
<?php
//Env Config
error_reporting(E_ALL);
ini_set('display_errors',1);
//disable output buffering.
while (ob_get_level()) ob_end_flush();
//Ensure this script can't be run by the web server.
if(php_sapi_name()!=="cli"){
echo "Must be run from the command line.";
@derak-kilgo
derak-kilgo / order-uncancel.php
Created October 7, 2016 17:09
One-off tool to uncancel an order in magento 1.x
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the commend line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/
require_once('app/Mage.php');
umask(0);
if (!Mage::isInstalled()) {
#!/bin/bash
echo "Watching $1 \n"
#Usage: watch-apache.sh my.server.com
#Watch verbose server status
#watch -c -n 5 "links -dump http://$1:80/server-status | tail -n+20 | grep -v ::1"
#watch scoreboard w/ color and diff highlights
watch -c -d -n 5 "curl -s -X GET 'http://$1:80/server-status?auto'"
@derak-kilgo
derak-kilgo / convert.php
Created August 22, 2016 13:00 — forked from anonymous/convert.php
Batch resize images with ImageMagick ( and php )
<?php
//path to image magick
$convert = '/usr/local/bin/convert';
$source = __DIR__ . '/all_images';
$dest = __DIR__ . '/resize';
$quality = 95; // 1-100 ; 92 is default.
$maxSize = 3680; //in pixels
@derak-kilgo
derak-kilgo / matrixish.sh
Created August 17, 2016 19:30 — forked from ttscoff/matrixish.sh
A Matrix-ish display for Bash terminal
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
@derak-kilgo
derak-kilgo / mp4-to-gif.php
Created August 17, 2016 18:30
Convert a mp4 clip into a gif with php, imagemagick and ffmpeg. From OSX, these are easy to install with homebrew.
<?php
$video = __DIR__ . '/video.mp4';
$fps = 4;
# Convert an MP4 to a GIF - Requires ffmpeg
`ffmpeg -i "$video" -pix_fmt rgb24 -r $fps "$video.gif"`
# optimize the gif - Requires imagemagick
# via http://superuser.com/questions/436056/how-can-i-get-ffmpeg-to-convert-a-mov-to-a-gif
@derak-kilgo
derak-kilgo / vine_to_gif.rb
Created August 17, 2016 18:27 — forked from seyhunak/vine_to_gif.rb
Vine.co mp4 to GIF using Ruby
# space150 vine-to-GIF
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it
# requires ruby, ffmpeg, and imagemagick
require 'open-uri'
require 'nokogiri'
id = ARGV[0]
# try to convert from URL to id.
#!/bin/bash
#see your mojo profile for this key. Will change if your password is every updated.
mojo_access_key="xxxxx"
#A specific agent id number. See mojo url for id number.
mojo_assignee_id="xxxxx"
#URL to check for tickets. You can changes the filters to suite your need.
#This one only finds issues assigned to specific id with a status of new or in progress
@derak-kilgo
derak-kilgo / cli-export.php
Created February 5, 2016 18:52
Magento Loop through a collection (stand alone)
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the command line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/