Skip to content

Instantly share code, notes, and snippets.

@stowns
stowns / oddOccurences.js
Last active May 16, 2019
couple of toy fn's
View oddOccurences.js
function oddOccurences(arr) {
let odds = [];
let previous;
let count = 0;
for (let i = 0; i < arr.length; i++) {
let current = arr[i];
if (!previous) {
previous = current;
}
@stowns
stowns / Kafka Helpers
Last active Aug 29, 2015
kafka helper functions for my .bash_profile
View Kafka Helpers
# Kafka Helpers
export KAFKA_HOME=/opt/apps/kafka_2.9.2-0.8.1.1
function startZookeeper() {
$KAFKA_HOME/bin/zookeeper-server-start.sh /opt/apps/kafka_2.9.2-0.8.1.1/config/zookeeper.properties&
}
function shutdownZookeeper() {
$KAFKA_HOME/bin/zookeeper-server-stop.sh
}
@stowns
stowns / neo4j-util.rb
Last active Aug 29, 2015
Neo4j Env Switch Helper
View neo4j-util.rb
#!/usr/bin/ruby -w
###
# Author - Simon Townsend <stownsend@unifiedsocial.com>
#
# Inspiration - needed a quick way to switch back and forth between dbs for testing/dev'ing purposes.
#
# - Defaults assume that you installed neo4j via Homebrew (2.0.2)
# - works by swapping out a target env properties file ie) neo4j-server.properties.dev for neo4j-server.properties
# and starting/restarting the server
# - run with '-h' for available options (or read below)
View gist:2126ecb8d1562d25f9b9
/*
* Author: Simon Townsend <stowns3@gmail.com>
*/
var fs = require('fs'),
_ = require('lodash'),
request = require('request'),
async = require('async'),
fromProjectUrl = 'https://someteam.jira.net',
fromCreds = new Buffer("username:password").toString('base64'),