Skip to content

Instantly share code, notes, and snippets.

@sweetmandm
sweetmandm / PhoneFormat.swift
Last active October 24, 2017 19:50
Simple Phone Number Formatting for String + UITextField
// Usage:
// ------
// /* add the action somewhere: */
// phoneTextField.addTarget(self, action: #selector(updatePhoneFormat), for: .editingChanged)
// /* implement the update action: */
// func updatePhoneFormat() { phoneTextField.formatPhoneNumber() }
import UIKit
extension String {
set-option -g default-shell /bin/zsh
set -g mouse on
# remove the 1-sec delay after pressing 'escape'
set -sg escape-time 0
### Appearance Changes
# status line
set -o vi
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad
export GREP_OPTIONS='--color-auto'
export PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[0;36m\]\W\[\e[m\] \[\e[0;32m\]\$\[\e[m\] \[\e[0;37m\]'
class Liblouisutdml < Formula
homepage "http://liblouis.org"
url "https://code.google.com/p/liblouisutdml/", :using => :hg, :tag => "tip"
sha1 ""
version "tip"
depends_on "automake"
depends_on "autoconf"
depends_on "libtool"
depends_on "pkg-config"
class Liblouis < Formula
homepage "http://liblouis.org"
url "https://github.com/liblouis/liblouis.git", :using => :git, :tag => "v2.6.2"
sha256 ""
depends_on "autoconf"
depends_on "automake"
depends_on "libtool"
depends_on "texinfo"
@sweetmandm
sweetmandm / uptimemonitor.sh
Last active July 26, 2023 07:01
Cron job to monitor websites and send an email if the website is down.
#! /bin/sh
# A script to monitor uptime of websites,
# and notify by email if a website is down.
SITES="ADD COMMA-SEPARATED WEBSITES HERE"
EMAILS="ADD COMMA-SEPARATED EMAILS HERE"
for SITE in $(echo $SITES | tr "," " "); do
if [ ! -z "${SITE}" ]; then
RESPONSE=$(curl -s --head $SITE)
if echo $RESPONSE | grep "200 OK" > /dev/null
@sweetmandm
sweetmandm / itcingest.sh
Created February 24, 2013 01:14
I wanted to experiment with downloading my sales & reports data from iTunesConnect, but didn't want to have to keep referring to the [reporting instructions](http://www.apple.com/itunesnews/docs/AppStoreReportingInstructions.pdf). I made this little script to store most of the info I need, and I simply customize the last line to match whatever I…
#! /bin/sh
# itcingest.sh
# pulls data from iTunes Connect
set +x #quiet things down
# Note: the below iTCdir MUST include Autoingestion.class from Apple. If you don't
# have it, you can download it here: apple.com/itunesnews/docs/Autoingestion.class.zip
# (you also need Java installed. On OSX it'll prompt you to install it if you don't.)
@sweetmandm
sweetmandm / replaceFilenameString.sh
Created February 12, 2013 03:23
Just a simple bash script to batch rename files: takes one or two strings as arguments, and removes or replaces all instances of that string from within all filenames in the specified directory.
# /bin/sh
#
# Replaces a string from all filenames in the sourcedir.
# If the second argument is empty, it will simply remove the string.
sourcedir="."
stringToChange="$1"
replacementString="$2"
cd "$sourcedir"
@sweetmandm
sweetmandm / batchConvertPNGtoPVR.sh
Created December 19, 2012 02:30
Script to batch-convert a directory of PNG files to iOS-compativle PVR using the PVRTexTool command-line tool.
#! /bin/sh
# Batch process png to pvr conversion
# using PVRTexTool Command-line tool
#take all files of this type:
filetype="png"
#take them from here:
sourcedir="./"
#put them here:
@sweetmandm
sweetmandm / .bash_profile
Last active March 27, 2017 13:28
some of the most helpful settings & aliases I've come across to include in .bash_profile
#aliases
alias ..="cd .."
alias ...="cd ..; cd .."
alias la="ls -a"
# Get readable list of network IPs
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
alias flush="dscacheutil -flushcache" # Flush DNS cache