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
# Build Docker image and run it as a container. | |
def up | |
begin | |
lock = File.open('/var/lock/subsys/pool.lock', 'w') | |
if lock.flock(File::LOCK_EX | File::LOCK_NB ) | |
image_id = build | |
container_id = run image_id | |
confirm_running container_id | |
else |
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/bash | |
echo "Notify commits to slack" | |
channel=$2 | |
icon=$4 | |
payload="payload={\"channel\":\"$channel\",\"username\":\"webhookbot\",\"text\":\"Push on ${STASH_REPO_NAME} by ${STASH_USER_NAME} <$STASH_USER_EMAIL>\",\"icon_emoji\":\"$icon\",\"attachments\":[" | |
while read from_ref to_ref ref_name; do | |
message=`git log --format=%B -n 1 ${to_ref}` | |
title="[$STASH_REPO_NAME:$ref_name] <$3/commits/$to_ref|$to_ref>: $message" |
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 python | |
import pprint | |
import json | |
import corenlp | |
corenlp_dir = "/tmp/stanford-corenlp-full-2013-06-20" | |
parser = corenlp.StanfordCoreNLP(corenlp_path=corenlp_dir) | |
result_json = json.loads(parser.parse("hey shut down the station")) | |
pprint.pprint(result_json) |
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
slick { | |
default="infra.dao.*" | |
dbs { | |
default { | |
driver="slick.driver.MySQLDriver$" | |
db { | |
driver=com.mysql.jdbc.Driver | |
url="jdbc:mysql://127.0.0.1:3306/dev?useUnicode=true&characterEncoding=UTF-8" |
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
// reference: https://github.com/pepelkod/iOS-Examples/blob/master/PlaySoundWithVolume/PlaySoundWithVolumeAction.m | |
import SpriteKit | |
public extension SKAction { | |
public class func playSoundFileNamed(fileName: String, atVolume: Float, waitForCompletion: Bool) -> SKAction { | |
let nameOnly = fileName.stringByDeletingPathExtension | |
let fileExt = fileName.pathExtension | |
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
enum SoundEffectType:Int { | |
case Whitsle = 0, | |
Finish, | |
CDThree, | |
CDTwo, | |
CDOne, | |
CDGo, | |
Good, | |
Great, | |
Excellent, |
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
def wait? &block | |
i = 1 | |
while i < 5 do | |
block.call(i) | |
sleep 0.2 | |
i = i+1 | |
end | |
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
package main | |
import "fmt" | |
func main() { | |
var a chan struct{} | |
fmt.Println("Hello, playground") | |
a = make(chan struct{}) |
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 'selenium-webdriver' | |
require 'logger' | |
class AppiumServer | |
def initialize(opts = {}) | |
@port = Selenium::WebDriver::PortProber.above(3000) | |
@log = ::Logger.new(STDOUT) | |
end | |
def start |
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 'rufus-scheduler' | |
$stdout.sync = true | |
scheduler = Rufus::Scheduler.new | |
def exec_command(cmd) | |
IO.popen(cmd) do |io| | |
while (line = io.gets) do |