Skip to content

Instantly share code, notes, and snippets.

Justin Poliey jdp

Block or report user

Report or block jdp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jdp
jdp / redis-delkeys.sh
Created Aug 21, 2013
Delete keys matching a pattern from Redis
View redis-delkeys.sh
#!/bin/sh
#
# Usage: ./redis-delkeys.sh [-h host] [-p port] [-n db] pattern
#
# Matches keys with the KEYS command matching pattern
# and deletes them from the specified Redis DB.
set -e
HOST="localhost"
@jdp
jdp / redis-movekeys.sh
Created Aug 22, 2013
Move keys matching pattern from one database to another
View redis-movekeys.sh
#!/bin/sh
#
# Usage: ./redis-movekeys.sh [-h host] [-p port] [-n src] [-m dest] pattern
#
# Move keys matching pattern from the src Redis database to the
# dest Redis database.
set -e
HOST="localhost"
View SketchSystems.spec
Logged-out
Login
success -> Project List
failure -> Login
Logged-in*
search -> Search Results
logout -> Login
Project List
@jdp
jdp / example.php
Created Mar 26, 2012
Partial function application with PHP
View example.php
<?php
function foo($a, $b) {
echo "a: {$a} b: {$b}\n";
}
$foo_caller = new PartialCallable('foo', array('A'));
$foo_caller('B');
$foo_caller = partial_function('foo', 'A');
$foo_caller('B');
@jdp
jdp / LICENSE
Last active Apr 20, 2018
A* pathfinding over any arbitrary graph structure, with example Cartesian grid implementation
View LICENSE
Copyright (C) 2012 Justin Poliey <justin.d.poliey@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@jdp
jdp / refactor.py
Created Dec 7, 2010
A toy tail-recursive concatenative language implementation
View refactor.py
#!/usr/bin/env python
import sys
import types
import operator
class Runtime:
def __init__(self, env={}, stack=[]):
self.env = {
# Primitive words, not an impressive base but it works
@jdp
jdp / bleb.php
Created Jul 8, 2010
BlebCT's PHP framework
View bleb.php
<?php
/**
* The Bleb PHP Framework
*
* @author Justin Poliey <jdp34@njit.edu>
* @copyright BlebCT 2010
* @package bleb
*/
namespace Bleb {
@jdp
jdp / countmin.py
Created Apr 7, 2013
example count-min sketch implementation
View countmin.py
import random
class CountMinSketch(object):
def __init__(self, w, d, p):
self.w = w
self.d = d
self.p = p
self.C = [[0] * self.w for _ in range(self.d)]
self.a = [random.randint(1, self.p) for _ in range(self.d)]
@jdp
jdp / Makefile
Created Aug 31, 2012
Use Makefiles for CoffeeScript, Handlebars, and Sass
View Makefile
COFFEEC = coffee
SASSC = sass
HANDLEBARSC = handlebars
# Build app package
APPSRC = static/scripts/main.coffee
APPOBJ = ${APPSRC:.coffee=.js}
APPOUT = static/scripts/app.js
@jdp
jdp / golf.sh
Last active Apr 29, 2016
Solution to Daily Programmer 264
View golf.sh
awk 'NF {print $NF}' | tr a-z A-Z | tr -d .,\"\; |
xargs -n 1 -I % grep '^% ' cmudict-0.7b |
perl -lne 'if (/.*\b((AA|AE|AH|AO|AW|AY|EH|ER|EY|IH|IY|OW|OY|UH|UW).*)/) {print $1}' |
tr -d 0-9 | awk 'BEGIN{i=1} !seen[$0] {seen[$0]=i++} {print seen[$0]}' | tr 1-9 a-j | tr -d '\n'
You can’t perform that action at this time.