Skip to content

Instantly share code, notes, and snippets.

// thx: https://github.com/bcherry/twitter-text-js/blob/master/twitter-text.js
var stringSupplant = function(str, values) {
return str.replace(/#\{(\w+)\}/g, function(match, name) {
return values[name] || "";
});
};
@datfaf
datfaf / gist:4278746
Created December 13, 2012 19:01 — forked from tored/supplant.js
function supplant(s, o) {
return s.replace(/\{([^{}]*)\}/g,
function (a, b) {
var r = o[b];
return typeof r === 'string' || typeof r === 'number' ? r : a;
}
);
}
@datfaf
datfaf / delicious.py
Created September 30, 2012 12:54
Delicious Backup Script
#! /usr/bin/env python
# The Delicious API only returns 1000 bookmarks at a time.
# The web export returns them all in a single file.
# This script uses the latter to back up your bookmarks.
#
# To use:
# 1. Install requests: http://python-requests.org
# 2. Substitute your username and password below
# 3. Run and enjoy!
@datfaf
datfaf / build-microcore64.sh
Created August 4, 2012 10:31 — forked from Jared314/build-core64.sh
Remaster Tiny Core Linux MicroCore for x64
#!/bin/sh
wget http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/microcore-current.iso
wget http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/distribution_files/microcore64.gz
wget http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/distribution_files/vmlinuz64
# extract files
7z x microcore-current.iso -omicrocore-current
rm -rf microcore-current/[BOOT]
chmod 744 microcore-current/boot/isolinux/isolinux.bin
@datfaf
datfaf / supplant.js
Created March 14, 2012 12:41 — forked from couchoud/supplant.js
basic hs templating using String object and Regex
if (typeof String.prototype.supplant !== 'function') {
String.prototype.supplant = function (o) {
return this.replace(/{([^{}]*)}/g,
function (a, b) {
var r = o[b];
return typeof r === 'string' ? r : a;
});
};
}
#!/bin/bash
BACKUP_DIR="/var/db/backups"
PGUSER="postgres"
IGNORE_DATABASES="
postgres
template0
template1
"
@datfaf
datfaf / appify
Created September 10, 2011 21:31 — forked from subtleGradient/appify
appify. Create the simplest possible mac app from a shell script
#!/usr/bin/env bash
#
# url : https://gist.github.com/672684
# version : 2.0.2
# name : appify
# description : Create the simplest possible mac app from a shell script.
# usage : cat my-script.sh | appify MyApp
# platform : Mac OS X
# author : Thomas Aylott <oblivious@subtlegradient.com>
@datfaf
datfaf / gist:1208821
Created September 10, 2011 21:30
Curl Example
# Get a web page and store in a local file
curl -o thatpage.html http://www.netscape.com/
@datfaf
datfaf / dropbox-setup.sh
Created September 6, 2011 22:21 — forked from jbhannah/dropbox-setup.sh
Dropbox setup on a headless Ubuntu Server (http://wp.me/pnbL6-5F)
#!/bin/sh
# Dropbox setup on a headless Ubuntu Server
# Script written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on http://wiki.dropbox.com/TipsAndTricks/UbuntuServerInstall
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@datfaf
datfaf / dropbox-and-git.sh
Created September 6, 2011 22:04 — forked from uhhuhyeah/dropbox-and-git.sh
Use Dropbox as a remote git repo
# Instructions for setting up a remote repo on Dropbox
# Assuming project/repo called 'myrepo'
cd ~/Dropbox
mkdir -p git/myrepo.git
cd !$
git --bare init
cd ~/development/uhy/myrepo
git remote add dropbox file://$HOME/Dropbox/git/myrepo.git