Skip to content

Instantly share code, notes, and snippets.

@johnzeringue
johnzeringue / colors.sh
Created July 1, 2014 19:04
A bash script to print a table showing all shell colors
#!/bin/bash
#
# This file echoes a bunch of color codes to the terminal to demonstrate
# what's available. Each line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a test use of that color
# on all nine background colors (default + 8 escapes).
#
# Source:
# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
#
@johnzeringue
johnzeringue / printf.py
Created June 20, 2014 20:59
printf in Python with Python 3-style format strings
def printf(format, *args, **kwargs):
"""printf in Python with Python 3-style format strings"""
print(format.format(*args, **kwargs), end='')
@johnzeringue
johnzeringue / matches.py
Last active August 29, 2015 14:02 — forked from fmasanori/jogos.py
import requests
for match in requests.get('http://worldcup.sfg.io/matches').json():
if match['status'] == 'completed':
print('{home[code]} {home[goals]}, {away[code]} {away[goals]}' \
.format(home=match['home_team'], away=match['away_team']))
@johnzeringue
johnzeringue / HelloWorld.java
Last active August 29, 2015 14:01
A simple hello world program in Java to test GitHub Gists
/**
* A basic hello world in Java
*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}