Skip to content

Instantly share code, notes, and snippets.

View jarrodhroberson's full-sized avatar

Jarrod Roberson jarrodhroberson

View GitHub Profile
@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;
@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
@valerysntx
valerysntx / underscore.uuid.js
Last active December 17, 2015 13:49
client javascript uuid v4 and v5 generator. do not require additional libs. adopted from 'superscore' extensions by David Souther. http://davidsouther.github.com/superscore/ usage: var randomUUID = underscore.UUID.v4(); var uuidv5 = underscore.UUID.v5(msg,namespace);
var underscore = (function(underscore){
// Build several namespaces, globally...
var UUID = {};
var Sha1 = function(str){return Sha1.hash(str, true);};
var Utf8 = {};
var extend = function() {
var options, name, src, copy, copyIsArray, clone,
@Kyle-Mendes
Kyle-Mendes / String.prototype.format.js
Last active January 12, 2016 22:44
String.prototype.format
String.prototype.format = function() {
var self = this,
formats = self.match(/{(:?\d*)}/g), // an array of formats `{}` found in the string
counter = 0, // A counter to keep track of what index to replace with
args = arguments; // Dereferencing arguments for use in the nested code blocks
if (formats) {
formats.forEach(function(format) { // We loop through each format expression in the array
var namedMatch = format.match(/{:(\d+)}/), // Checking if the format is a named replacement (i.e. {:1})
reg;
@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 (mike@ensor.cc)
# 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
@jarrodhroberson
jarrodhroberson / find_in_jar.bat
Last active November 16, 2017 00:50 — forked from leogomes/find_in_jar.sh
bash and windows shell scripts to find classes in .jar files in a directory
# Windows (cmd) Command line version
forfiles /S /M *.jar /C "cmd /c jar -tvf @file | findstr /C:"$1" && echo @path"
@ophentis
ophentis / gist:5473449
Created April 27, 2013 15:16
setting multiple private key for ssh
1.
ssh-keygen -t rsa -f ~/.ssh/id_rsa.work -C "Key for Word stuff"
2.
touch ~/.ssh/config
chmod 600 ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.work" >> ~/.ssh/config
echo "IdentityFile ~/.ssh/id_rsa.misc" >> ~/.ssh/config
import com.google.common.reflect.TypeToken;
@SuppressWarnings("unchecked")
public T get()
{
final Class<T> entityType = (Class<T>) new TypeToken<T>(getClass()) {}.getRawType();
try { return entityType.newInstance(); }
catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); }
}
@jarrodhroberson
jarrodhroberson / tictactoe.py
Created July 25, 2019 17:10
Python 3 TicTacToe Game for Console
# Import needed modules
import os
import time
import re
# Regular Expression to validate that the input is in the expected format!
inputPattern = re.compile('^\d{1},\d{1}$')
#Initialize a 2D array to represent the board using a SPACE to represent unclaimed cells.
board = [[' ' for x in range(3)] for y in range(3)]

Some notes on transparency in social systems

This is the PC sitting on my desk right now:

...as you can see, it is literally transparent - you can look right into it! The components and physical connections between them, laid bare - they even put stupid lights on many of the components now, anticipating this level of transparency. Must be pretty easy to see how it works, right?

Well, no, of course not. Most of the interesting stuff is still obscured, happening at an atomic level inside what are literal black boxes. The layer at which it is transparent is irrelevant to most of the problems I might have to solve. When discussing the potential benefits of, costs of, and need for transparency in a system, it is critical to first establish the layer being discussed - otherwise, you may very well end up with a gaudy display that serves no real purpose. This is as true in social systems as it is in physical ones such as