Skip to content

Instantly share code, notes, and snippets.

View mattrasband's full-sized avatar

Matt Rasband mattrasband

  • The Grid
  • 13:30 (UTC -06:00)
View GitHub Profile
@mattrasband
mattrasband / ChatServer.js
Last active December 30, 2015 10:39
A basic chat server written in Node.js. Tried to improve on the ones that are currently floating around. Note: Not great from telnet on Windows - works fine on *nix.
/*
File: ChatServer.js
Author: Nerdwaller
Description:
A fairly simple chat server using Node.js.
It takes several pieces from other scripts, adds some original pieces, and additional functionality.
*/
var net = require("net");
// Server Config
@mattrasband
mattrasband / PyMailer.py
Created December 6, 2013 03:38
A simple SMTP mailer written in Python allowing file attachments (gmail is the default).
#!/usr/bin/env python
import urllib2, sys, os, smtplib, argparse
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import formatdate
from email import encoders
parser = argparse.ArgumentParser(description='Send messages through SMTP server from the command line.')
@mattrasband
mattrasband / DynamicIPWatcher.sh
Last active December 30, 2015 23:29
Check the current IP vs the previous known IP, mail out any changes uses the PyMailer script
#!/usr/bin/env bash
# == User Set ==
# py_mailer2 location
mailer='/root/server_scripts/py_mailer/py_mailer2.py'
# latest ip file location
latest_known_ip='/root/.ip'
#to
to='someone@example.com'
# Gmail Username / Password
@mattrasband
mattrasband / BatchImgWatermark.sh
Created December 10, 2013 21:50
Batch watermark images using `composite` from Image-Magick
#!/usr/bin/env bash
#============================================
# Apply a watermark to a batch of images
# in the source directory after verifying
# that the images are not corrupted.
# This applies the watermark based off
# the source image's resolution.
# (recommended WM base size of 500px wide)
#============================================
@mattrasband
mattrasband / AutoImageSorter.sh
Created December 10, 2013 21:52
Automatically sort images into folders based on their EXIF data.
#!/usr/bin/env bash
SRC=${1:-"/mnt/camSD"}
DEST=${2:-"/home/`whoami`/Pictures"}
EXT=${3:-"jpg"}
#UUID=null # Get UUID with `blkid /dev/sdX#`
function checkResources {
if [ ! -L "/dev/disk/by-uuid/${UUID}" ]; then
echo "The disc is not mounted, the process will halt."
@mattrasband
mattrasband / Initial_Setup-Mac.sh
Last active August 29, 2015 13:56
Script to setup a Mac
#!/usr/bin/env bash
# This is adapted from other similar scripts and pieces of my own added in.
# I can't find the original source, but if you are aware of it, please comment
# so I can link back to them. Thanks!
# Prompt the user to get Apple's Command Line Tools
open http://adcdownload.apple.com/Developer_Tools/command_line_tools_os_x_mountain_lion_for_xcode__october_2013/command_line_tools_os_x_mountain_lion_for_xcode__october_2013.dmg
# Ask for the administrator password upfront
# Similar to os.path.walk but traverses up the tree
def walkup(bottom=os.path.dirname(__file__)):
"""Similar to os.walk, but up the tree
instead of down.
"""
path = os.path.realpath(bottom)
dirs = []
files = []
for item in os.listdir(path):
@mattrasband
mattrasband / com.eclipse.eclimd.plist
Last active August 29, 2015 14:13
Eclim Launch Agent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.eclipse.eclimd</string>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true/>
@mattrasband
mattrasband / .ycm_extra_conf.py
Last active April 19, 2017 15:54
You Complete Me Arduino Configuration
import os
import ycm_core
# You can set a directory with a lot of libraries to be search recursively here
ArduinoLibDir = ["/Applications/Arduino.app/Contents/Resources/Java/libraries", "/Applications/Arduino.app/Contents/Java/libraries"]
# This is the list of all directories to search for header files
libDirs = ArduinoLibDir + ["lib"]
flags = [
@mattrasband
mattrasband / Requirements
Created May 6, 2015 23:56
Installing iPython on Mac
pip install pyzmq --install-option="--zmq=bundled"
pip install matplotlib jinja2 tornado jsonschema pygments mistune