Skip to content

Instantly share code, notes, and snippets.

View pads's full-sized avatar

Ben Paddock pads

View GitHub Profile
@pads
pads / Arguments assignment fix
Created November 29, 2012 16:59
@FND's suggested fix for arguments assignment
var args = Array.prototype.slice.apply(arguments);
args[2] = false;
@pads
pads / configure_npm.sh
Last active December 15, 2015 02:39
Various scripts to install TiddlySpace on a barebones Ubuntu server.
#!/bin/sh
#
# Run this script before installing twikifier/twsock and after installing node
#
npm config set registry http://registry.npmjs.org/
# Omit this step if a proxy is not needed
npm config set proxy http://<host>:<port>
@pads
pads / ts-import-space.sh
Last active December 16, 2015 15:59
Export tiddlers from the public and private bags of a space belonging to one instance of TiddlySpace and import them onto a different instance of TiddlySpace.
#!/bin/sh
USAGE="Usage: `basename $0` <src_space_url> <src_space> <src_user>
<src_pwd> <dest_space_url> <dest_space> <dest_user> <dest_pwd>
Overwrite SRC_TS_CHALLENGER and/or DEST_TS_CHALLENGER
to use a custom authentication method.
The default is tiddlywebplugins.tiddlyspace.cookie_form
"
@pads
pads / byod.sh
Last active December 17, 2015 04:09
A script to automate the bringing of one's domain over to tiddlyspace
#!/bin/sh
# This script writes a domain name to the Nginx aliases file
# and adds the corresponding tiddler to the MAPSPACE bag.
# Run ./byod.sh without any arguments for usage.
DOMAIN=$1
TARGET_SPACE=$2
WWW_DOMAIN=$3
@pads
pads / tiddlywebconfig.py
Last active December 17, 2015 06:48
Backup of my dev instance tiddlyspace config
# A basic configuration.
# `pydoc tiddlyweb.config` for details on configuration items.
config = {
'system_plugins': ['tiddlywebplugins.tiddlyspace'],
'secret': '19ea4f518345d7f89c99a679b5957ebb6efc4b2a',
'twanager_plugins': ['tiddlywebplugins.tiddlyspace'],
'server_host': {
'scheme': 'http',
'host': 'tiddlyspace.org',
@pads
pads / ts-tiddler-loop.sh
Created May 21, 2013 13:07
This simple script came about as a way to find out what would happen between twikifier and tiddlyspace when testing failure scenarios (such as killing processes randomly).
#!/bin/sh
if [ $# -lt 3 ]; then
echo "Usage: `basename $0` space_url port tiddler_title"
exit 1
fi
SPACE_URL=$1
PORT=$2
TIDDLER=$3
@pads
pads / transparency.css
Last active December 18, 2015 16:39
A collection of CSS hacks
/* For IE7 & 8 */
.transparent-black {
/* IE7 needs an element to be positioned in order to apply a transparent background, this is a work-around */
zoom: 1;
background-color: #000;
filter: alpha(opacity=70);
/* Fill the parent container */
position: absolute;
top: 0;
left: 0;
@pads
pads / missing_ldap_users.py
Created July 24, 2013 15:38
Print a list of users not found in an LDAP directory, given a file where each line is a user ID that would map to a valid CN in the LDAP directory.
import ldap
ldap_host = '<host>'
ldap_port = '389'
base_dn = '<ou=something,ou=com>'
username = '<username>'
password = '<password>'
filename = '<file_with_list_of_user_ids>'
@pads
pads / TiddlerInclude.html
Created July 29, 2013 16:12
Quick spike of using an AJAX include pattern to load tiddlers as content in a page, based on tag and title.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ajax Include Spike</title>
</head>
<body>
<div data-tiddlers="fragment">
<div data-tiddler="Fragment2">tiddler two loaded here</div>
<div data-tiddler="Fragment3">tiddler three loaded here</div>
@pads
pads / archive_bag.py
Last active December 20, 2015 17:18
Archive tiddlers from one bag to another, based on age.
import logging
from datetime import datetime
from tiddlywebplugins.tiddlyspace.config import config
from tiddlyweb.store import Store
from tiddlyweb.model.tiddler import Tiddler
now = datetime.utcnow()
# Make sure this is writable by the user running this
filename = 'archive-%s-%s-%s.log' % (now.year, now.month, now.day)