Skip to content

Instantly share code, notes, and snippets.

View jsumners's full-sized avatar

James Sumners jsumners

View GitHub Profile
@jsumners
jsumners / pom.xml
Last active December 19, 2015 02:58
A base pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jrfom</groupId>
<artifactId>CHANGE-ME</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
@jsumners
jsumners / fw.sh
Created October 7, 2013 20:18
A simple iptables script usable on any new server. Build from it.
#!/bin/bash
## Initial firewall building script.
## Should be run as root.
it=$(which iptables)
################################################################################
## Use this section to establish prerouted port redirects.
## For example, redirect port "80" to port "8080".
@jsumners
jsumners / OjdbcDriverListener.java
Last active December 31, 2015 21:29
POS Oracle drivers refusing to unload, causing memory leaks, and killing the god damn PermGen space.
package com.jrfom.fuck.oracle;
import java.lang.management.ManagementFactory;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.management.MBeanServer;
/*
* The author disclaims copyright to this source code. In place of
* a legal notice, here is a blessing:
*
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
*
*/
package org.hibernate.dialect;
'use strict';
/**
* Mirrors nodejs.org/dist (mostly). It doesn't grab Windows stuff
* because I'm not interested in that. And it's configured to only
* grab specific version trees.
*
* Relies on a 'dist' directory being present in the directory
* where the script is run.
*/
@jsumners
jsumners / example.yml
Created July 12, 2016 19:23
Ansible plugin to loop subset of a hash
vars:
users:
foo:
uid: 1
bar:
uid: 2
foobar:
uid: 3
tasks:
@jsumners
jsumners / foo.js
Created October 25, 2016 13:40
jsdoc-to-markdown documenting a factory function that returns an object literal
/**
* @module foo
*/
/**
* Describe initialization
* @param {object} someInnerGlobal A context
* @return {fooFactory}
* @alias init
*/
#!/bin/bash
#
# This script is for generating a random password, setting it for a specified
# user, and sending that password to a remote listener.
WHO=$(whoami)
# target user for password change
USER=jsumners
RECVR="10.0.0.10"
PORT=8000
if [ $WHO != "root" ]; then
@jsumners
jsumners / Readme.md
Created November 8, 2016 14:43
Task list query

Synopsis

I need an application to track tasks that I have completed. I do not need it to track tasks that I will complete. Features:

  • [preferred] a menubar application, no dock icon
  • [requirement] allows specifying storage location, i.e. just a file on the file system
  • [preferred] storage format is parseable, e.g. JSON
  • [requirement] records date item was entered
  • [requirement] allows multiple selection of items to be copied into the clipboard as a list
  • [requirement] items older than a certain number of days would be hidden/archived
// https://tc39.github.io/ecma262/#sec-set-constructor
const MyList = class MyList extends Set {}
MyList.fromArray = function (aray) {
const list = new MyList()
array.forEach((a) => list.add(a)
return list
}
MyList.prototype.has = function (ele) {