Skip to content

Instantly share code, notes, and snippets.

View mdaley's full-sized avatar

Matthew Daley mdaley

  • Bristol, United Kingdom
View GitHub Profile

VTK

This installs the latest VTK which is, currently, 9.0.0.

Build on OSX

Clone the project:

git clone git@github.com:Kitware/VTK.git
# CREATING GPG KEYS
gpg —full-generate-key
- 1 (RSA and RSA)
- 4096 (key size)
- 0 (valid forever)
- Personal details
- Password (avoid awkward characters like ! or %)
See what you have:
e.g.
ssh -L 3307:dbserver...com:3306 me@someserver...com -N
locally: mysql -h 127.0.0.1 --port 3307 -u dbname -p
@mdaley
mdaley / gist:a0d1f5d3393756ac0530
Created September 8, 2015 09:13
mysql random pin generation function
drop function if exists randalpha;
create function randalpha (s varchar(100))
returns char(1)
return substring(s, floor (rand() * length(s) + 1), 1);
drop function if exists randpin;
delimiter //
create function randpin(l int, r varchar(100))
Creation of lots of Integer instances:
(time (reduce + (range 1000000)))
~ 25 - 35 ms
Using primitive types:
(time (loop [x 0 acc 0] (if (>= x 1000000) acc (recur (inc x) (+ acc x)))))
@mdaley
mdaley / gist:cc68d797f1dd2bd0229f
Created June 2, 2015 15:47
Alipay stripe example
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_6pRNASCoBOKtIshFeQd4XMUh',
image: '/img/documentation/checkout/marketplace.png',
alipay: "true",
1. Change to the directory with DynamoDBLocal.jar
2. Create a new file called log4j.properties with the contents:
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=_LOG_%d %p [%c] - %m%n
3. Remove the existing log4j.properties files from the jar (there might be two)
-- apple script to create a terminal when run for the first time and create an additional
-- terminal on every subsequent call. Bind to ctrl-alt-t using apptivate and then you have
-- the same terminal creation as in ubuntu; which is what I'm used to.
on run {input, parameters}
if application "iTerm" is not running then
tell application "iTerm"
reopen
activate
@mdaley
mdaley / Git bash prompt
Created July 22, 2014 08:54
Git bash prompt
This sorts out the problem of lines not wrapping properly.
export PS1='\[\e]0;\u@\h: \w\a\]\[\e[32;1m\]${debian_chroot:+($debian_chroot)}\u@\h:\w \[\e[33;1m\]$(__git_ps1 "[%s] ")\[\e[32;1m\]\$ \[\e[0m\]'
Copy exactly into your .bashrc. Note that __git_ps1 is a builtin (comes with git I assume) feature that provides the branch you are on if you are in a git area. There's no need for a separate function to obtain this information.
Read this page if interested about what all the funny, cryptic characters are all about:
http://www.ibm.com/developerworks/linux/library/l-tip-prompt/