This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ]\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?// 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); |