Skip to content

Instantly share code, notes, and snippets.

View y-yoshinoya's full-sized avatar

Yuki Yoshinoya y-yoshinoya

View GitHub Profile
To get started with Docker/Marathon/Mesos, you need to install a
new Mesos, a new Marathon, and Deimos, the bridge to Docker.
You'll also need Docker and the JVM. These instructions are for
Ubuntu 13.10.
## Install Mesos prerequisites
:; sudo apt-get update
:; sudo apt-get install zookeeperd default-jre python-setuptools python-protobuf curl pip
## Install recent Mesos
@motemen
motemen / Ojisan-Patterns.md
Last active March 7, 2025 08:19
おじさんパターン集
  • その面白そうな話、私も参加していいよね?なぜなら私は無条件に受け入れられているからおじさん(闖入おじさん) #おじさんパターン
  • 後出し難癖おじさん #おじさんパターン
  • 困難は成長のチャンス!だから君たちに成長の機会をあげようおじさん (成長おじさん) #おじさんパターン
  • あらゆる事案に一般論コメントおじさん #おじさんパターン
  • 俺ってあらゆることに精通してるじゃん?だから力になるよおじさん (精通おじさん) #おじさんパターン
@yattom
yattom / Crypto.java
Last active January 8, 2021 06:39
AES暗号・復号をJavaとRubyで実装したサンプルです。言語間で相互に暗号化・復号ができます。
import java.security.AlgorithmParameters;
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.security.spec.*;
import org.apache.commons.codec.binary.Base64;
@a-ono
a-ono / gist:8642560
Created January 27, 2014 02:47
play2 linkTo
def linkTo(label: String, url: String, options: (Symbol, Any)*) = Html(
options.foldLeft(<a href={url}>{label}</a>) {
case (elem, (k, v)) =>
elem % new xml.UnprefixedAttribute(k.name, v.toString, elem.attributes)
}.toString
)
# 私が考える安全なプログラムを書くために必要なこと
今も昔も「入力によって挙動が大幅に変わるAPI」が世の中には多数存在していて、プログラマが本来意図した挙動と異なる動作を引き起こしている。
- ファイルを開こうとしたらコマンドを実行できてしまったり
- CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり
- SELECT文を発行するつもりがDELETE文を発行できてしまったり
こういったときに
- 入力値検証をしないと危険になる

redcaretとgithub-markdownの違い

  • 両者のソースは割りと似ている(github-markdownがredcarpetを元にしたのか、あるいは両者のもとになったC実装があるとかかな)

オプションについて

github-markdownは、redcapetの提供するオプションの一部をデフォルトで有効化します。 (ちなみに有効化するオプションを選ぶAPIはない模様。用途を考えるとそれで正しいが)

★がついているのが有効化されるもの。gfmモード(.render_gfmメソッド)の場合のみ、★★も有効化される。

@ebith
ebith / add_twitter_option.js
Created June 17, 2013 23:39
direct_bookmark.jsにツイッター連携付きのはてなブックマークを行うオプションを追加する(要はてブ拡張)
liberator.registerObserver(
'enter',
function () {
commands.get('sbm').options.push([['-t', '-twitter'], liberator.modules.commands.OPTION_NOARG]);
libly.$U.around(
commands.get('sbm'),
'action',
function (next, [args]) {
if (args['-t']) {
@xuwei-k
xuwei-k / build.scala
Created April 10, 2013 03:36
source generators from github
import sbt._
import Keys._
object build extends Build{
def github(org: String, name: String, hash: String): Project = Project(
name, file(name)
).settings(
baseSettings ++ seq(
sourceGenerators in Compile <+= (sourceManaged in Compile){ dir => task{
@djangofan
djangofan / endorsedmethod.java
Last active January 6, 2023 22:05
Exercise on safely waiting for unstable web elements with WebDriver.
// This is the official Selenium documention endorsed method of waiting for elements.
// This method is ineffective because it still suffers from
// the stale element exception.
public static void clickByLocator ( final By locator ) {
WebElement myDynamicElement = ( new WebDriverWait(driver, 10))
.until( ExpectedConditions.presenceOfElementLocated( locator ) );
myDynamicElement.click();
}
@hexx
hexx / htmldsl.scala
Created March 1, 2013 18:51
HtmlDSL using Dynamic
import scala.language.dynamics
import scala.util.DynamicVariable
sealed trait Node {
def toXml: String
}
case class ElementNode(name: String, attributes: Map[String, String], children: List[Node]) extends Node {
def toXml = {