Skip to content

Instantly share code, notes, and snippets.

View KellyLSB's full-sized avatar

Kelly Becker-Neuding KellyLSB

View GitHub Profile
@KellyLSB
KellyLSB / example.php
Created August 19, 2011 15:43 — forked from mloberg/example.php
A simple Postmark PHP Class
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
if($postmark->to("reciver@example.com")->subject("Email Subject")->plain_message("This is a plain text message.")->send()){
echo "Message sent";
}
@KellyLSB
KellyLSB / parallels_clone_update_mac.sh
Created November 26, 2012 07:08
Updates a cloned Parallels Ubuntu VM network interface configuration with the proper mac address
#!/usr/bin/env sh
#
# Change the MAC Address on an Ubuntu Parallels Cloned VM
# Author: Kelly Becker (KellyLSB)
# Check for sudo access
SUDO=`sudo -n uptime 2>&1|grep "load"|wc -l`
if [ $SUDO -lt 1 ]
then
echo "You need to have sudo priveleges!"
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
# Given a stream of crontab lines, exclude non-cron job lines, replace
@KellyLSB
KellyLSB / Apt-Mirror Wrapper
Last active December 14, 2015 21:08
Allows you to include or exclude different repositories and components from your apt-mirror run.
#!/usr/bin/env ruby
require 'getoptlong'
# Class Extensions
class String
def first
self[0..0]
end
def last
@KellyLSB
KellyLSB / Ruby CLI IO Streaming.
Last active December 15, 2015 01:29
Getting input and output with popen3 in ruby simultaneously.
#!/usr/bin/env ruby
require 'open3'
Open3.popen3('ping 127.0.0.1') do |i,o,e,t|
Thread.new do
while true
begin
system("stty raw -echo")
str = STDIN.getc.chomp
ensure
@KellyLSB
KellyLSB / gist:7836185
Last active December 30, 2015 13:29
Change Ruby Symbol Keyed Hash Syntax on Save to the new Ruby 1.9.3 - 2.0 Syntax (Only changes symbol keys)
import sublime, sublime_plugin, os
class RubyPostProcess(sublime_plugin.EventListener):
def on_pre_save(self, view):
syntax = os.path.basename(view.settings().get('syntax'))
syntax = os.path.splitext(syntax)[0]
if syntax == "Ruby":
replacements = []
edit = view.begin_edit()
---
us: %m/%d/%Y
/*
SublimeLinter default settings
*/
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.
@KellyLSB
KellyLSB / Dockerfile
Last active January 1, 2016 02:29
Docker.io Ubuntu Sources.list
FROM ubuntu
MAINTAINER "Kelly Becker (kbecker@kellybecker.me)"
# Basic provisioning
RUN apt-get install apt-utils wget nano curl openssh-server
RUN wget --no-check-certificate https://gist.github.com/KellyLSB/8079486/raw/4d2b2f8e9b609258ef4f72ef13a50effd3bb224b/sources.list -O /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 16126D3A3E5C1192
RUN apt-get update
RUN apt-get dist-upgrade -y
@KellyLSB
KellyLSB / ruby_post_process.py
Last active January 1, 2016 18:39
Ruby Post Processing Plugin for `Sublime Text 2` Place in `~/Library/Application Support/Sublime Text 2/Packages/User/ruby_post_process.py`
import sublime, sublime_plugin, os, re
class RubyPostProcess(sublime_plugin.EventListener):
def on_pre_save(self, view):
syntax = os.path.basename(view.settings().get('syntax'))
syntax = os.path.splitext(syntax)[0]
filepath = view.file_name()
filename = os.path.basename(filepath)