Skip to content

Instantly share code, notes, and snippets.

cmawhorter / spc
Created Mar 10, 2013
Simple shell script to output a number of blank lines. Defaults to 30.
View spc
#!/usr/bin/env bash
# usage: `spc` or `spc [number of lines]`
for ((i=1; i<=$lines; i++))
View redis-server
# redis - this script starts and stops the redis-server daemon
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/
cmawhorter / redis.conf
Created Jun 7, 2013
default redis 2.6.10 conf with daemonize set to yes
View redis.conf
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
View stampr-hello-world.php
// Stampr Mailing Hello World in PHP!
require 'vendor/autoload.php';
require 'src/Stampr/Stampr.php';
$stampr_login = "";
$stampr_password = "your.stampr.password";
$endpoint = "";
View stampr-testing-batch.php
// Stampr API - Create a Batch for Testing
require 'vendor/autoload.php';
require 'src/Stampr/Stampr.php';
$stampr_login = "";
$stampr_password = "your.stampr.password";
$endpoint = "";
cmawhorter / fabricjs-thumbnail.js
Created Jun 26, 2014
The only way I could generate real-time thumbnails of a fabricjs canvas
View fabricjs-thumbnail.js
// see for full post
// Put this in an after:render event handler.
// Be warned: Ripped out of working code and renamed variables without testing.
var fabricMain = new fabric.Canvas('main')
, fabricThumb = new fabric.Canvas('screenshot')
, ctxThumbnail = $('canvas#thumbnail')[0].getContext('2d');
cmawhorter / proxy.js
Created Jun 26, 2014
Node script to forward all http requests to another server and return the response with an access-control-allow-origin header. Follows redirects.
View proxy.js
// Simple proxy/forwarding server for when you don't want to have to add CORS during development.
// Usage: node proxy.js
// Open browser and navigate to http://localhost:9100/[url]
// Example: http://localhost:9100/
// This is *NOT* for anything outside local development. It has zero error handling among other glaring problems.
// This started as code I grabbed from this SO question:
cmawhorter / grunt-build.bat
Last active Apr 19, 2016
Script to build grunt/yeoman project from jenkins on windows 7
View grunt-build.bat
@echo off
REM You may need to add `cd %WORKSPACE%` in the jenkins project prior to
REM calling this script. I have it in mine and didn't test without.
REM Correct paths to respective applications as-needed
SET PATH=%PATH%;C:\Program Files (x86)\nodejs;C:\Program Files (x86)\Git\bin;%AppData%\npm;C:\Ruby200-x64\bin
echo Installing or updating bower...
cmawhorter / async-download.js
Created Jul 10, 2014
Downloads all files in an array 2 at a time
View async-download.js
var fs = require('fs');
var path = require('path');
var async = require('async');
var request = require('request');
var tasks = {};
var json = { /* your records */ };
cmawhorter / convert-to-svg.bat
Last active Aug 29, 2015
Converts all (vector) files in a directory to svg using ps2pdf, uniconvertor and inkscape.
View convert-to-svg.bat
@echo off
REM This will fail with "the input line is too long" if you have a lot of files... maybe?
REM Don't know why, but I think the solution is breaking the body of the for () into a separate
REM batch. But... IDGAF.
echo Starting...
for %%i in (*.*) do (
echo Looking at... %%~di%%~pi%%~ni%%~xi