Skip to content

Instantly share code, notes, and snippets.

@macdrifter
macdrifter / CsvToArray.py
Created December 8, 2012 12:01 — forked from tony-landis/CsvToArray.py
Convert CSV string to fixed width text table
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
@macdrifter
macdrifter / DropboxSync.py
Created November 13, 2012 22:46 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
@macdrifter
macdrifter / formd-pythonista.py
Created October 18, 2012 00:16 — forked from ttscoff/formd-pythonista.py
A modified version of formd for use with Pythonista on iOS
# encoding=utf8
"""
formd by Seth Brown, 02-24-12
modified for iOS use (Pythonista) by Brett Terpstra, 10-17-12
"""
from sys import stdin, stdout
import clipboard
import re
from collections import OrderedDict
@macdrifter
macdrifter / pinbook.js
Created October 15, 2012 00:51 — forked from ChewingPencils/pinbook.js
Pinbook Bookmarklet
javascript:window.location='pinbook:///add?url='%20+%20encodeURIComponent(document.location.href)%20+%20'&title='%20+%20encodeURIComponent(document.title);
@macdrifter
macdrifter / rss-subscribers.sh
Created September 26, 2012 00:38
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/var/log/httpd/access_log"
@macdrifter
macdrifter / gist:3066528
Created July 7, 2012 13:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@macdrifter
macdrifter / gist:3066526
Created July 7, 2012 13:45 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@macdrifter
macdrifter / hack.sh
Created May 4, 2012 01:49
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#