Skip to content

Instantly share code, notes, and snippets.

@adambom
adambom / README.md
Last active May 22, 2020 05:09
Backup Kubernetes Cluster State

Run this in order to backup all you k8s cluster data. It will be saved in a folder bkp. To restore the cluster, you can run kubectl apply -f bkp.

Please note: this recovers all resources correctly, including dynamically generated PV's. However, it will not recover ELB endpoints. You will need to update any DNS entries manually, and manually remove the old ELB's.

Please note: This has not been tested with all resource types. Supported resource types include:

  • services
  • replicationcontrollers
  • secrets
  • deployments
  • horizontal pod autoscalers
@nownabe
nownabe / .commit_template
Created July 5, 2016 06:54
Emojiで楽しく綺麗なコミットを手に入れる
# ==== Emojis ====
# 🐛 :bug: バグ修正
# 👍 :+1: 機能改善
# ✨ :sparkles: 部分的な機能追加
# 🎉 :tada: 盛大に祝うべき大きな機能追加
# ♻️ :recycle: リファクタリング
# 🚿 :shower: 不要な機能・使われなくなった機能の削除
# 💚 :green_heart: テストやCIの修正・改善
@co-sche
co-sche / aws-eb-play-scala.md
Last active March 31, 2023 05:24
AWS Elastic Beanstalk (Java8)に最小手順でPlay Framework (Scala)のアプリをデプロイする

sbt dist

これだけで${PROJECT_ROOT}/target/universal/に起動スクリプトなどを含んだパッケージ(zip)が生成される。

内部でsbt-native-packagerが呼ばれる。

これは一応プラグインだけど、今のPlayではビルトインなので、addSbtPluginする必要はない。

けど、まだEBでそのままデプロイできるパッケージではない。

Procfile

@y-taka-23
y-taka-23 / alloy_aws_security_group.als
Created December 6, 2015 14:31
Alloy による AWS セキュリティグループのモデリング
// **************************************************
// AWS セキュリティグループのモデル
// **************************************************
// 通信プロトコル
enum Protocol { TCP, UDP, ICMP }
// 通信ポート
sig Port {}
@tkawachi
tkawachi / gpg_memo.md
Last active January 19, 2021 15:45
GPG memo

鍵の作成

$ gpg --gen-key

いろいろ聞かれるので答える。

鍵をなくした時や盗まれた時に無効化できるように revoke certificate を作る。

$ gpg --gen-revoke -o "revoke.cert" "KeyID"

Kafkaつらい

Kafkaとは?

  • もともとLinkedinが作ったやつ
  • 今はapacheプロジェクト
  • Scalaで作られてる
  • 公式には "Apache Kafka is publish-subscribe messaging rethought as a distributed commit log." って書いてあった

基本的な(?)情報

import scalaz._
import Free.FreeC
class DDD[Entity, ID] {
// repositoryへの操作を代数的データ型で定義し、それをFreeとCoyonedaの力によりモナドにして使う
sealed abstract class RepositoryDSL[A]
// 見つからないかもしれないので結果はOption型
final case class ResolveBy(id: ID) extends RepositoryDSL[Option[Entity]]
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@gakuzzzz
gakuzzzz / hoge.md
Created December 19, 2014 15:11
doctest import
  /**
   * {{{
   * prop> import org.scalacheck.{Gen, Arbitrary}
   * prop> import org.scalacheck.Arbitrary._
   * prop> import foo.BarType
   * prop> val itemTypeGen = Gen.oneOf(BarType.values)
   * prop> implicit val barTypeArbitrary = Arbitrary(barTypeGen)
   * prop> (i: Int, t: BarType) => i > 10
   * }}}
@manjuraj
manjuraj / typesafe-builder.scala
Last active July 22, 2020 14:09
typesafe builders in scala
//
// References:
// - http://www.tikalk.com/java/type-safe-builder-scala-using-type-constraints/
// - http://www.blumenfeld-maso.com/2011/05/statically-controlling-calls-to-methods-in-scala/
// - http://dcsobral.blogspot.com/2009/09/type-safe-builder-pattern.html
// - http://blog.rafaelferreira.net/2008/07/type-safe-builder-pattern-in-scala.html
// - http://jim-mcbeath.blogspot.com/2009/09/type-safe-builder-in-scala-part-4.html
// - http://villane.wordpress.com/2010/03/05/taking-advantage-of-scala-2-8-replacing-the-builder/
// - http://debasishg.blogspot.com/2010/08/using-generalized-type-constraints-how.html#sthash.GKfUGq9p.dpuf
//