Skip to content

Instantly share code, notes, and snippets.

View mcculley's full-sized avatar

Gene McCulley mcculley

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mcculley on github.
  • I am genemcculley (https://keybase.io/genemcculley) on keybase.
  • I have a public key whose fingerprint is 7E85 58E7 2A00 4339 053E 53EE BA5F 453B 3548 6509

To claim this, I am signing this object:

Verifying that +genemcculley is my Bitcoin username. You can send me #bitcoin here: https://onename.io/genemcculley
@mcculley
mcculley / words2contacts.sh
Created June 5, 2017 19:58
A little script to convert a word list into an address book in vCard/VCF format.
#!/bin/sh
if [ $# -eq 0 ]
then
cat << EOF
Usage: $0 <wordlist> > contacts.vcf
Converts a list of words, one per line, in <wordList> into an address book in
vCard/VCF format. This is useful for working around autocorrect problems on iOS.
EOF
exit 0
fi
@mcculley
mcculley / TerroristGroups.txt
Last active October 29, 2018 22:55
simple SQL query of Global Terrorism Database (https://www.start.umd.edu/gtd/) by perpetrator group
SELECT perpetrator_group_name, COUNT(perpetrator_group_name) AS incident_count FROM gtd WHERE country_txt = 'United States' GROUP BY perpetrator_group_name ORDER BY incident_count DESC;
perpetrator_group_name | incident_count
--------------------------------------------------------------------------+----------------
Unknown | 573
Anti-Abortion extremists | 196
Left-Wing Militants | 169
Fuerzas Armadas de Liberacion Nacional (FALN) | 120
White extremists | 87
New World Liberation Front (NWLF) | 86
@mcculley
mcculley / TerroristGroupsByTotalKilled.txt
Created October 29, 2018 23:19
simple SQL query of Global Terrorism Database (https://www.start.umd.edu/gtd/) by perpetrator group and total US killed
SELECT perpetrator_group_name, SUM(nkillus) AS total_killed FROM gtd WHERE country_txt = 'United States' AND nkillus > 0 GROUP BY perpetrator_group_name ORDER BY total_killed DESC;
perpetrator_group_name | total_killed
---------------------------------------------------+--------------
Al-Qaida | 2907
Anti-Government extremists | 185
Jihadi-inspired extremists | 91
Unknown | 54
White extremists | 49
Black Nationalists | 23
@mcculley
mcculley / TerroristGroupsTotalKilled.txt
Created October 29, 2018 23:30
simple SQL query of Global Terrorism Database (https://www.start.umd.edu/gtd/) by perpetrator group and total killed
SELECT perpetrator_group_name, SUM(nkill) AS total_killed FROM gtd WHERE country_txt = 'United States' AND nkill > 0 GROUP BY perpetrator_group_name ORDER BY total_killed DESC;
perpetrator_group_name | total_killed
--------------------------------------------------------------------------+--------------
Al-Qaida | 3001
Anti-Government extremists | 244
Jihadi-inspired extremists | 106
Unknown | 77
White extremists | 51
Black Nationalists | 24
#!/bin/sh
# A simple wrapper around executing a Maven build to avoid starting up a JVM
# and doing unnecessary work.
if [ -n "$(find src -newer target)" ]
then
mvn package
fi
@mcculley
mcculley / Account.java
Last active June 28, 2020 20:39
Typical JUnit example
public class Account {
public static class InsufficientFundsException extends Exception {
}
private int balance;
public synchronized void transferTo(final int amount, final Account destination) throws InsufficientFundsException {
synchronized (destination) {
withdraw(amount);
@mcculley
mcculley / Account.java
Last active June 28, 2020 20:38
Embedded test example
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class Account {
public static class InsufficientFundsException extends Exception {
}
@mcculley
mcculley / Account.java
Last active July 1, 2020 14:58
A simple example of a bank account model
public class Account {
public static class InsufficientFundsException extends Exception {
}
private int balance;
public synchronized void transferTo(final int amount, final Account destination) throws InsufficientFundsException {
synchronized (destination) {
withdraw(amount);