Skip to content

Instantly share code, notes, and snippets.

@takezoe
takezoe / init.el
Last active November 20, 2017 17:17
My Emacs configuration
;;
;; init.el
;;
;; Language.
(set-language-environment 'Japanese)
;; Coding system.
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model._
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.ActorMaterializer
import scala.concurrent.ExecutionContext.Implicits.global
object AkkaHttpSample extends App {
@takezoe
takezoe / pom.xml
Last active June 19, 2016 04:41
Maven configuration template for the simple web application with Java 8
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sample-webapp</groupId>
<artifactId>sample-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>sample-webapp Maven Webapp</name>
<url>http://maven.apache.org</url>
@takezoe
takezoe / HystrixFutureCommand.scala
Last active November 12, 2018 07:28
Hystrix adapter for scala.concurrent.Future
package utils
import com.netflix.hystrix.{HystrixCommandGroupKey, HystrixObservableCommand}
import rx.Observable
import rx.lang.scala.subjects.ReplaySubject
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
abstract class HystrixFutureCommand[T](groupKey: HystrixCommandGroupKey)(implicit ec: ExecutionContext)
package util
import scala.concurrent.{Future, Promise}
import com.netflix.hystrix.HystrixObservable
object Futures {
private class ForPromiseObserver[T](p: Promise[T]) extends rx.Observer[T] {
@takezoe
takezoe / HystrixSupport.scala
Last active June 17, 2016 01:16
HystrixSupport for Play 2.5
package controllers
import play.api.mvc._
import java.util.concurrent.atomic.{AtomicInteger, AtomicReference}
import com.netflix.config.scala.DynamicIntProperty
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
import play.api.Logger
import play.api.libs.iteratee.Enumerator
import java.util.concurrent.TimeUnit

権限の管理構造

  • Organization (= User)
    • Team
      • User
      • Type: Owner | Member
  • Repository
    • Contributors
      • User
  • Role: Admin | Write | Read
@takezoe
takezoe / GitBucketCoreModuleSpec.scala
Last active May 25, 2016 17:36
Test for GitBucket Migration with MySQL
package gitbucket.core
import java.sql.DriverManager
import org.scalatest.FunSuite
import com.wix.mysql.EmbeddedMysql._
import com.wix.mysql.config.MysqldConfig._
import com.wix.mysql.distribution.Version._
import io.github.gitbucket.solidbase.Solidbase
import io.github.gitbucket.solidbase.model.Module
@takezoe
takezoe / update_seq_postgresql.sql
Created April 29, 2016 18:23
Run after data import to PostgreSQL
SELECT setval('label_label_id_seq', (select max(label_id) + 1 from label));
SELECT setval('activity_activity_id_seq', (select max(activity_id) + 1 from activity));
SELECT setval('access_token_access_token_id_seq', (select max(access_token_id) + 1 from access_token));
SELECT setval('commit_comment_comment_id_seq', (select max(comment_id) + 1 from commit_comment));
SELECT setval('commit_status_commit_status_id_seq', (select max(commit_status_id) + 1 from commit_status));
SELECT setval('milestone_milestone_id_seq', (select max(milestone_id) + 1 from milestone));
SELECT setval('issue_comment_comment_id_seq', (select max(issue_comment_id) + 1 from issue_comment));
SELECT setval('ssh_key_ssh_key_id_seq', (select max(ssh_key_id) + 1 from ssh_key));
@takezoe
takezoe / ExportMigrationXML.scala
Created January 9, 2016 08:09
H2からSolidbase用のXMLを生成するときに使ったやつ
package gitbucket.core
import java.sql.{Connection, DriverManager}
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
object ExportMigrationXML extends App {
Class.forName("org.h2.Driver")
val conn = DriverManager.getConnection("jdbc:h2:~/.gitbucket/data;MVCC=true", "sa", "sa")