Skip to content

Instantly share code, notes, and snippets.

View laughingman7743's full-sized avatar
🤣

laughingman7743

🤣
  • Nagoya
  • 10:42 (UTC +09:00)
View GitHub Profile
@mrfyda
mrfyda / LoveLetter.scala
Created November 19, 2013 23:07
A SecureString Example
package model
import model.traits.BaseTable
import model.traits.SecureTable
import play.api.libs.Crypto
import scala.slick.driver.PostgresDriver.simple._
case class LoveLetter(id: Long, fromId: Long, toId: Long, content: SecureString)
@mather
mather / gist:5771655
Last active December 18, 2015 10:49
SlickでTimestampのカラムをDateTimeとして扱うために、暗黙の変換(implicit conversion)を行う方法。 単なるメモなので、動作は保証出来ません。
/* util パッケージで宣言する場合 */
package object util {
import java.sql.Timestamp
import com.github.nscala_time.time.Imports.DateTime
import scala.slick.lifted.MappedTypeMapper
/* 結果値 Timestamp をアプリケーションでは DateTime に変換して使う */
implicit def dateTimeMapper = MappedTypeMapper.base[DateTime,Timestamp](
/* f: DateTime -> Timestamp */
dt => new Timestamp(dt.getMillis),
anonymous
anonymous / new_task.py
Created January 2, 2013 22:15
Create multiple RabbitMQ connections from a single thread, using Pika and multiprocessing.Pool. Based on tutorial 2 (http://www.rabbitmq.com/tutorials/tutorial-two-python.html).
#!/usr/bin/env python
import sys
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
'localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello', durable=True)
@matope
matope / NoSQLデータモデリング技法.markdown
Created April 16, 2012 03:35
NoSQLデータモデリング技法

#NoSQLデータモデリング技法

原文:NoSQL Data Modeling Techniques « Highly Scalable Blog

I translated this article for study. contact matope[dot]ono[gmail] if any problem.

NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。

本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う

@kencoba
kencoba / Builder.scala
Created February 21, 2012 05:43
Builder pattern (Design patterns in Scala)
abstract class Product
abstract class PizzaBuilder {
var dough: String
var sauce: String
var topping: String
def withDough(dough: String): PizzaBuilder
def withSauce(sauce: String): PizzaBuilder
def withTopping(topping: String): PizzaBuilder
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@fabiant7t
fabiant7t / s3_multipart_upload.py
Created April 17, 2011 14:54
Parallel S3 multipart upload with retries
import logging
import math
import mimetypes
from multiprocessing import Pool
import os
from boto.s3.connection import S3Connection
from filechunkio import FileChunkIO