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
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "No OAuth token supplied. Create one with: " | |
echo "curl -u 'YOUR_GIT_USERNAME' -d '{\"scopes\":[\"gist\"],\"note\":\"Help example\"}' https://api.github.com/authorizations" | |
echo "Use the token value that is shown in the json output." | |
else | |
URL=$(xclip -o | python -c "import sys, json; print json.dumps({ 'public': True, 'files': { 'gistit.txt': { 'content': sys.stdin.read() } } })" | curl -H "Authorization: token $1" https://api.github.com/gists -d @- 2>&1 | grep -E '"html_url": ".*gist.*' | sed 's/.*html_url": "\([^ ]*gist[^"]*\)",/\1/') | |
echo $URL | xclip -i -selection clipboard |
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
package mykafkatest | |
import java.net.ServerSocket | |
import java.nio.file.Files | |
import java.util.{UUID, Properties} | |
import kafka.consumer.{Whitelist, ConsumerConfig, Consumer} | |
import kafka.producer.{ProducerConfig, Producer, KeyedMessage} | |
import kafka.serializer.StringDecoder | |
import kafka.server.KafkaConfig |
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
object RomanNumerals { | |
import annotation._ | |
trait Numeral { | |
def num:Int | |
} | |
class RomanNumeral[T<:Numeral](n:Int) extends Number with Ordered[RomanNumeral[Numeral]] { | |
private val MAX_ROMAN = 3999 | |
val num = if(n > 0 && n % MAX_ROMAN != 0) n % MAX_ROMAN else (n % MAX_ROMAN) + MAX_ROMAN |
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
#!/bin/bash | |
set -e | |
CONF_FILE=$(</etc/haproxy.conf.tmpl) | |
echo "CONF_FILE has original content:" | |
echo "#####" | |
echo "$CONF_FILE" | tee /usr/local/etc/haproxy/haproxy.conf | |
echo "#####" | |
echo |