This file contains hidden or 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.util.*; | |
public class Scratch { | |
public static void main(String[] args) { | |
HashMap<String, Integer> stuff = new HashMap<String, Integer>() {{ | |
put("A", 1); | |
put("B", 2); | |
put("C", 3); | |
}}; | |
This file contains hidden or 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
#!/bin/sh | |
if [ $# != 5 ]; then | |
echo "Utility for setting up NAT forwarding to VBox guests" | |
echo "Usage: $0 GUEST SERVICE PROTOCOL GUESTPORT HOSTPORT" | |
echo "E.g. $0 \"Linux Guest\" guestssh TCP 22 2222" | |
echo "NOTE: Port forwarding will only affect stopped VMs" | |
exit 1 | |
fi | |
guest=$1 |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
gem 'rack', '=0.9.1' | |
gem 'thin', '=1.0.0' | |
require 'sinatra' | |
get '/' do | |
content_type 'text/plain' | |
"Hello, world" | |
end |
This file contains hidden or 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
require 'rbconfig' | |
def hello(source, expect_input) | |
puts "Hello from #{source}" | |
if expect_input | |
puts "Standard input contains: \"#{$stdin.read}\"" | |
else | |
puts "No stdin, or stdin is same as parent's" | |
end | |
$stderr.puts "Hello, standard error" |
This file contains hidden or 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
require 'rbconfig' | |
$stdout.sync = true | |
def hello(source, expect_input) | |
puts "[child] Hello from #{source}" | |
if expect_input | |
puts "[child] Standard input contains: \"#{$stdin.readline.chomp}\"" | |
else | |
puts "[child] No stdin, or stdin is same as parent's" |
This file contains hidden or 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
# :PUBLISHER: markdown, shell, { command: 'rdiscount' } | |
# :BRACKET_CODE: '[ruby]', '[/ruby]' | |
# :TEXT: | |
# | |
# Have you ever started a long operation and walked away from the computer, and | |
# come back half an hour later only to find that the process is hung up waiting | |
# for some user input? It's a sub-optimal user experience, and in many cases it | |
# can be avoided by having the program choose a default if the user doesn't | |
# respond within a certain amount of time. One example of this UI technique in | |
# the wild is powering off your computer - most modern operating systems will |
This file contains hidden or 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
# :PUBLISHER: source, gist | |
# A basic example of a Germinate article. | |
# | |
# This text is "front matter" and will not be included in the final article. | |
# The article doesn't begin until the first text directive. | |
# | |
# Let's set up code bracketing so that code excerpts will be surrounded by HTML | |
# <pre>...</pre> tags. | |
# | |
# :BRACKET_CODE: <pre>, </pre> |
This file contains hidden or 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
# :PUBLISHER: source, gist | |
# A basic example of a Germinate article. | |
# | |
# This text is "front matter" and will not be included in the final article. | |
# The article doesn't begin until the first text directive. | |
# | |
# Let's set up code bracketing so that code excerpts will be surrounded by HTML | |
# <pre>...</pre> tags. | |
# | |
# :BRACKET_CODE: <pre>, </pre> |
This file contains hidden or 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
# :PUBLISHER: source, gist | |
# A basic example of a Germinate article. | |
# | |
# This text is "front matter" and will not be included in the final article. | |
# The article doesn't begin until the first text directive. | |
# | |
# Let's set up code bracketing so that code excerpts will be surrounded by HTML | |
# <pre>...</pre> tags. | |
# | |
# :BRACKET_CODE: <pre>, </pre> |
This file contains hidden or 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
# #!/usr/bin/env ruby | |
# :PUBLISHER: source, gist | |
# :BRACKET_CODE: <pre>, </pre> | |
# :PROCESS: ruby, "ruby %f" | |
# :SAMPLE: hello | |
def hello(who) | |
puts "Hello, #{who}" | |
end |
OlderNewer