Skip to content

Instantly share code, notes, and snippets.

View jarrodhroberson's full-sized avatar

Jarrod Roberson jarrodhroberson

View GitHub Profile
@jarrodhroberson
jarrodhroberson / delve-jar.sh
Created March 12, 2013 16:52
A short Bash script to delve through a directory of .jar files and find the ones that contain a given package or class.
#!/bin/sh
find . -name '*.[jwes]ar' | while read LINE; do grep -q $1 "$LINE"; if [ $? -eq 0 ];then echo "$LINE"; jar tvf "$LINE" | grep $1;echo;fi;done
@jarrodhroberson
jarrodhroberson / size of array.cpp
Created November 12, 2012 15:33
How to get the length of an array with a template as well as pass in an array to a function to get its length in the function.
#include <cstdint>
#include <stdio.h>
template<typename T, size_t SIZE>
size_t getSize(T (&)[SIZE]) {
return SIZE;
}
typedef std::uint_fast8_t byte;
@bhavanki
bhavanki / colorize-maven.sh
Created June 21, 2012 21:10 — forked from mike-ensor/colorize-maven.sh
Colorize Maven output
#!/bin/sh
# Written by Mike Ensor ([email protected])
# Copywrite 2012
# Use as needed, modify, have fun!
# Modified by Bill Havanki
# This was intended to be used for Maven3 + Mac OSX, but it's been modified for Cygwin and Linux.
# Maybe it still works on OSX?
# Changes from original:
# - Cygwin support
@yincrash
yincrash / Google2APi.java
Created April 22, 2012 17:22
Google OAuth2.0 for scribe-java
package org.scribe.builder.api;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.scribe.exceptions.OAuthException;
import org.scribe.extractors.AccessTokenExtractor;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
@gclaramunt
gclaramunt / Event.java
Created March 28, 2012 18:13
Fluent state machine in Java
package statemachine;
public class Event {
final private String label;
public Event(String newLabel) {
label = newLabel;
}
/**
@maximebf
maximebf / webtail.py
Created October 21, 2011 13:25
Web tail / tail -f as a webpage using websocket
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//