I hereby claim:
- I am odenzo on github.
- I am odenzo (https://keybase.io/odenzo) on keybase.
- I have a public key whose fingerprint is 20E2 B77B A872 6A1A 4E70 2525 F42A C6A5 09F9 8CC0
To claim this, I am signing this object:
These two files should help you to import passwords from mac OS X keychains to 1password. | |
Assumptions: | |
1) You have some experience with scripting/are a power-user. These scripts worked for me | |
but they haven't been extensively tested and if they don't work, you're on your own! | |
Please read this whole document before starting this process. If any of it seems | |
incomprehensible/frightening/over your head please do not use these scripts. You will | |
probably do something Very Bad and I wouldn't want that. | |
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
I hereby claim:
To claim this, I am signing this object:
trait InboundTransforms extends StrictLogging { | |
protected def message2text(msg: Message): Future[String] = { | |
msg match { | |
case message: TextMessage.Strict ⇒ Future.successful(message.text) | |
case message: TextMessage.Streamed ⇒ message.textStream.runFold("")(_ + _) | |
case default ⇒ Future.successful("Default: " + default) | |
} | |
} |
import io.getquill.context.sql.SqlContext | |
trait PostgresDsl { this: SqlContext[_, _] => | |
/** | |
* @shortDescription A DSL extension to allow bitwise or operator on Int columns | |
* Tested with integer columns in postgres | |
*/ | |
implicit class BitwiseOR(s1: Int) { |
Verifying that "odenzo.id" is my Blockstack ID. https://explorer.blockstack.org/name/odenzo.id |
import io.circe._ | |
// Generalized in real-life | |
def fieldNameChangeEx(in: JsonObject): JsonObject = { | |
val fieldName = "type" | |
val newName = "tipe" | |
// Not sure what happens on missing fieldName or fieldName = null | |
val updated: Option[JsonObject] = in(fieldName) | |
.map(oldVal ⇒ in.add(newName, oldVal)) |
Given a case class like:
case class SignerListNode(
flags: Long,
ownerNode: Option[String],
previousTxnId: Option[TxnHash],
previousTxnLgrSeq: Option[LedgerSequence],
signerEntries: List[SignerEntry],
signerListID: Long,
signerQuorum: Long,
val get = quote { | |
query[Region].filter(_.code == lift(region)) | |
} | |
def insert(code: String) = quote { | |
query[Region].insert(lift(Region(code = code))).returning(_.id) | |
} | |
// HELP:: Better way? | |
val prog = for { | |
r <- run(get).map(_.head).recoverWith { |
trait CirceUtils { | |
val unCaptialize: String => String = s => | |
if s == null then null | |
else | |
s.headOption match { | |
case Some(v) if v.isUpper => s.drop(1).prepended(v.toLower) | |
case _ => s | |
} |
cass class MyCmd(a:Int, b:String, c:D) | |
def myFunction(a:Int, b:X, c:D) | |
val a = MyCmd(12, "Y", D.default) | |
val tupledCmd = Tuple.fromtProductTyped(a) // Will keep length and type data | |
myFunction.tupled(typledCmd) | |
To deal with mismatch of arge can add things to the tuple or partially apply the function before tupling |