Skip to content

Instantly share code, notes, and snippets.

@mprentice
mprentice / genpasswd.py
Last active June 14, 2020 16:26
genpasswd.py
#!/usr/bin/env python3
import argparse
import logging
import math
import random
import string
import typing
DEFAULT_DICT_FILE = "/usr/share/dict/words"
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Carp;
use Getopt::Long;
use Math::Random::Secure qw(rand irand);
@mprentice
mprentice / Carpfight
Created September 19, 2013 15:44
Carp fight between system perl libs and local libs
[Thu Sep 19 11:40:32 2013] startup.pl: Carp: /usr/lib/perl5/5.8.8/Carp.pm at /usr/local/tusk/current/conf/startup.pl line 11, <DATA> line 225.
[Thu Sep 19 11:40:32 2013] startup.pl: Carp::Heavy: /usr/local/tusk/current/local/lib/perl5/Carp/Heavy.pm at /usr/local/tusk/current/conf/startup.pl line 12, <DATA> line 225.
[Thu Sep 19 11:40:32 2013] startup.pl: INC: ../lib:../local/lib/perl5:/usr/local/tusk/current/lib:/usr/local/tusk/current/local/lib/perl5/x86_64-linux-thread-multi:/usr/local/tusk/current/local/lib/perl5:/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/site_perl/5.8.8:/usr/lib/perl5/site_perl:/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/vendor_perl/5.8.8:/usr/lib/perl5/vendor_perl:/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi:/usr/lib/perl5/5.8.8:.:/etc/httpd at /usr/local/tusk/current/conf/startup.pl line 13, <DATA> line 225.
#!/usr/bin/perl
# Copyright 2013 Tufts University
#
# Licensed under the Educational Community License, Version 1.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/ecl1.php
#
#!/bin/bash
# Currently works for Mac OS X 10.8: Mountain Lion
set -e
venvbin="`which virtualenv`"
if [ "$venvbin" = "" ] ; then
echo "Aborting (cannot find virtualenv)" >&2
exit 1;
@mprentice
mprentice / resolv.conf
Created April 30, 2013 15:39
/etc/resolv.conf
; generated by /sbin/dhclient-script
search hsd1.wa.comcast.net.
nameserver 10.0.1.1
@mprentice
mprentice / install-terminal-notifier
Last active December 16, 2015 05:09
terminal-notifier, an OS X command-line utility to put messages in Notification Center
# depends on homebrew
# As of 2013-04-14
brew pull https://github.com/mxcl/homebrew/pull/18511
brew install terminal-notifier
@mprentice
mprentice / bad_insert.log
Created September 24, 2012 15:50
Bad insert
#120923 19:50:08 server id 1 end_log_pos 544442402 Query thread_id=864430 exec_time=0 error_code=0
SET TIMESTAMP=1348444208/*!*/;
INSERT INTO content (display) VALUES ('0')
/*!*/;
# at 544442402
@mprentice
mprentice / xsl_license_fix.bash
Created August 10, 2012 21:11
Fix license text from xsl:comment to !--
#!/bin/bash
# Replace erroneous <xsl:comment> license tags with xml <!--> comments
bak="$HOME/tmp/xslbak"
mkdir -p "$bak"
find /usr/local/tusk/tusk-4_0_0 -name '*.xsl' -print0 | while IFS='' read -r -d '' fold ; do
lic=`awk '/<xsl:comment>/,/<\\/xsl:comment>/' "$fold" | grep 'licenses/ecl1\.php'`
if [ "" != "$lic" ] ; then
fdir="${fold%/*}"
@mprentice
mprentice / graphml.clj
Created July 6, 2011 17:53
GraphML target update
(def mytestxml
"<graphml>
<graph edgedefault='directed'>
<node id='n1' />
<node id='n2' />
<node id='n3' />
<node id='n4' />
<edge id='e1' source='n1' target='n3' />
<edge id='e2' source='n2' target='n3' />
</graph>