Skip to content

Instantly share code, notes, and snippets.

@thsutton
thsutton / add-classes-to-user-password-indicators.patch
Created April 3, 2013 23:56
Patch Drupal's user module JS to add classes to the password field indicators
diff --git a/htdocs/modules/user/user.js b/htdocs/modules/user/user.js
index d182066..e5e5abc 100644
--- a/htdocs/modules/user/user.js
+++ b/htdocs/modules/user/user.js
@@ -52,6 +52,11 @@ Drupal.behaviors.password = {
// Update the strength indication text.
$(innerWrapper).find('.password-strength-text').html(result.indicatorText);
+ $(innerWrapper).find('div.password-strength')
+ .removeClass('password-strength-error')
<?php
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernel;
@thsutton
thsutton / passphrase.sh
Last active December 11, 2015 12:29
Generate a random passphrase from the words in your system dictionary.
#!/bin/sh
#
# Generate an $N word passphrase from the words in $D.
#
N=6
D=/usr/share/dict/words
R=/dev/random
L=$(cat $D | wc -l)
od -An -tu4 -N $(expr $N \* 4) $R | \
xargs -n 1 -I @ sh -c "head -n \$(expr @ % $L) $D | tail -1" | \
1228.8G 201206150327
1.3G 201206180153
59.0G 201206290123
68.0G 201207090326
17.0G 201207160118
30.0G 201207200747
14.0G 201207310133
6.6G 201208030035
88.0G 201208100549
55.0G 201208240537
@thsutton
thsutton / invalid-users.txt
Created January 15, 2013 06:50
SSH scanning attempts.
1145 test
904 admin
637 a
570 oracle
540 net
516 cr
516 54
516 45ru
516 27
516 179
@thsutton
thsutton / README
Created June 15, 2012 08:59
Generate an empty Drupal module, with hooks.
mkmodule.sh
===========
This is a short script to create empty Drupal modules. Given a short name and
a list of hooks, it'll create a brand new module with placeholders of the
hooks you want.
sh mkmodule.sh example install uninstall requirements schema menu
@thsutton
thsutton / README.md
Created February 29, 2012 08:46
Basic Feeds support for nodereference CCK fields.

Node Reference support for Feeds

Adding basic support for Node Reference fields to the Feeds module is pretty straightforward (if you don't worry too much about the advanced features of nodereference).

In fact, it's almost a direct copy of the existing support for basic CCK field

@thsutton
thsutton / branch.hs
Created December 29, 2011 12:01 — forked from snoyberg/branch.hs
branch in conduits
{-# LANGUAGE NoMonomorphismRestriction #-}
import Data.Conduit
import qualified Data.Conduit.List as CL
branch :: Resource m
=> Sink lIn m lOut
-> Sink rIn m rOut
-> Sink (Either lIn rIn) m (lOut, rOut)
branch (Sink mlsink) (Sink mrsink) = Sink $ do
lsink <- mlsink
@thsutton
thsutton / mimetypecheck.sh
Created November 4, 2011 03:47
Check that MIME type header and file content match
#!/bin/sh
#
# Check that the MIME type sent be a web server and the type of data in the file match.
#
# Usage: mimetypecheck.sh http://example.com/ http://example.org/
CURL="curl --silent"
for URL in $*; do

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.