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
#!/usr/bin/env bash | |
# reset environment variables that could interfere with normal usage | |
export GREP_OPTIONS= | |
# put all utility functions here | |
# make a temporary file | |
git_extra_mktemp() { | |
mktemp -t "$(basename "$0")".XXXXXXX | |
} |
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 Turnstile { | |
def getTimes(time: Array[Int], direction: Array[Int]): Array[Int] = { | |
var lt = -1 | |
var ld = 1 | |
val result = Array.fill(time.length) { 0 } | |
time.foldLeft(time.zipWithIndex) { (q, _) => | |
val nt = q.head._1 |
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 main | |
import "sort" | |
type byLength []string | |
func (s byLength) Len() int { | |
return len(s) | |
} |
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 main | |
import "fmt" | |
type Person struct { | |
idx int | |
ts int32 | |
dir int32 | |
} |
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
#!/usr/bin/env bash | |
# make a temporary file | |
git_extra_mktemp() { | |
mktemp -t "$(basename "$0")".XXXXXXX | |
} | |
for param in $* | |
do | |
case $param in |
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 main | |
import ( | |
"fmt" | |
"math/big" | |
"sort" | |
"strings" | |
) | |
func findReciprocal(s string) string { |
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 com.github.xiaodongw.swagger.finatra | |
import com.google.inject.Guice | |
import com.twitter.finatra.json.Parameterizable | |
import com.twitter.finagle.http.MediaType | |
import com.twitter.finatra.json.ParameterizableResolver._ | |
import com.twitter.inject.Injector | |
import io.swagger.models._ | |
import io.swagger.models.parameters._ | |
import io.swagger.models.properties.{ArrayProperty, Property, RefProperty} |
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
FROM redis:3-alpine | |
COPY master.conf /usr/local/etc/redis/master.conf | |
COPY slave.conf /usr/local/etc/redis/slave.conf | |
COPY sentinel.conf /usr/local/etc/redis/sentinel.conf | |
RUN mkdir -p /var/log/redis | |
RUN mkdir -p /var/run/redis | |
RUN mkdir -p /var/lib/redis | |
RUN chown redis:redis /var/log/redis |
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 com.twitter.finagle.zookeeper | |
import com.twitter.common.zookeeper.ServerSet.EndpointStatus | |
import com.twitter.common.zookeeper.{ServerSet, ServerSetImpl, ZooKeeperClient} | |
import com.twitter.finagle.{Announcer, Announcement} | |
import com.twitter.util.{Future, NonFatal, Promise} | |
import java.net.InetSocketAddress | |
import java.util.concurrent.LinkedBlockingQueue | |
import scala.collection.JavaConverters._ | |
import scala.collection.mutable |
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
trait Service { | |
type A | |
type B | |
def getA:Option[A] | |
def getB:Option[B] | |
} |
NewerOlder