Skip to content

Instantly share code, notes, and snippets.

Kenny pieman72

Block or report user

Report or block pieman72

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
@pieman72
pieman72 / CheckBraces.java
Created Aug 3, 2015
A quick java program to check proper matching of braces in a file.
View CheckBraces.java
import java.io.*;
public class CheckBraces{
// Print errors and set exit status
public static void die(String msg){
System.err.println(msg);
System.exit(1);
}
// Process a file named with a CLI arg
@pieman72
pieman72 / hex_to_ansi
Last active Aug 29, 2015
Hex to ANSI color code converter
View hex_to_ansi
function hex_to_ansi(){
# Get the individual color components as decimals
HEX=$(echo "$1" | tr -d '#' | tr '[:lower:]' '[:upper:]')
DIGITS=$(( ${#HEX} / 3 ))
R=$(( 16#${HEX:$(( DIGITS * 0 )):$DIGITS} ))
G=$(( 16#${HEX:$(( DIGITS * 1 )):$DIGITS} ))
B=$(( 16#${HEX:$(( DIGITS * 2 )):$DIGITS} ))
# Handle grey ramp
if [ "`echo $(( R-G )) | tr -d '-'`" -lt 16 ]\
@pieman72
pieman72 / git.makefile
Last active Aug 29, 2015
A starter makefile with git recipes
View git.makefile
# Colorize output
COLORS:=$(shell tput colors 2> /dev/null)
ifeq ($(COLORS), 256)
COLOR_RESET=\033[0;39;49m
COLOR_BOLD=\033[1m
COLOR_ULINE=\033[4m
COLOR_BOLD_OFF=\033[0;21m
COLOR_ULINE_OFF=\033[0;24m
COLOR_NORM=\033[0;39m
COLOR_GREN=\033[38;5;118m
@pieman72
pieman72 / esheep.php
Created Jul 2, 2014
E-Sheep! They're what computers dream about.
View esheep.php
<?// Generate a random image based on a key
$key = sha1(isset($_GET['s']) ? $_GET['s'] : rand());
$WIDTH = isset($_GET['w']) ? $_GET['w'] : 150;
$HEIGHT = isset($_GET['h']) ? $_GET['h'] : 150;
// Globals
$MAX_SAT_LOSS = 0.4; // 0 - 1.0
$MAX_LUM_SKEW = 0.25; // 0 - 0.5
$COLORS = array();
$IMG = imagecreatetruecolor($WIDTH, $HEIGHT);
You can’t perform that action at this time.