Skip to content

Instantly share code, notes, and snippets.

View lanceon's full-sized avatar

Oleksiy lanceon

View GitHub Profile
@lanceon
lanceon / gist:3abbb4a33d08b5738833
Last active August 29, 2015 14:11
Oracle UTF8 environment variable
NLS_LANG = AMERICAN_AMERICA.AL32UTF8
Oracle SQL Developer - ide.conf:
AddVMOption -Duser.language=en
AddVMOption -Duser.region=us
@lanceon
lanceon / bookmark
Created December 19, 2014 16:39
Google Bookmark scriptlet
javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=420px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();
@lanceon
lanceon / gist:eae117d6ebb1b03da471
Last active August 29, 2015 14:13
Oracle SQL Developer Windows NLS
File: ide/bin/ide.conf
AddVMOption -Duser.language=en
AddVMOption -Duser.region=us
IntelliJ Idea:
/**
* http://stackoverflow.com/questions/9594431/scala-groupby-preserving-insertion-order
* It could be useful if you only need to access the results sequentially (no random access)
* and you want to avoid the overhead of creating and using Map objects.
*/
def groupByOrdered[T, P](seq: Traversable[T])(f: T => P): Seq[(P, Traversable[T])] = {
@tailrec
def accumulator(seq: Traversable[T], f: T => P, res: List[(P, Traversable[T])]): Seq[(P, Traversable[T])] = seq.headOption match {
case None => res.reverse
case Some(h) => {
@lanceon
lanceon / query.sql
Created July 13, 2015 11:12
Oracle constraint owner by name
SELECT owner, table_name
FROM dba_constraints
WHERE constraint_name = 'SYS_C0011446'
@lanceon
lanceon / JsBSONHandlers.scala
Created October 14, 2015 18:39 — forked from nevang/JsBSONHandlers.scala
Reader and writer in order to work with spray-json and reactivemongo. Based on https://github.com/zenexity/Play-ReactiveMongo.
import spray.json._
import reactivemongo.bson._
import reactivemongo.bson.handlers.{ BSONReader, BSONWriter, RawBSONWriter }
import scala.util.{ Try, Success, Failure }
import org.apache.commons.codec.binary.Hex
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{ DateTime, DateTimeZone }
import java.nio.ByteBuffer
import org.jboss.netty.buffer.ChannelBuffers
@lanceon
lanceon / idea64.vmoptions
Created December 6, 2014 19:14
Intellij Idea CE 14 config for 16 Gb RAM
-server
-Xms4g
-Xmx8g
-XX:NewRatio=2
-XX:+AggressiveOpts
-XX:MaxPermSize=384m
-XX:ReservedCodeCacheSize=225m
-XX:-TraceClassUnloading
-XX:+UseFastAccessorMethods
-XX:+OptimizeStringConcat
@lanceon
lanceon / idea64.exe.vmoptions
Created November 9, 2015 07:19
Intellij IDEA 15 x64 startup options (16 Gb RAM)
-Xms4g
-Xmx8g
-XX:MaxPermSize=384m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
@lanceon
lanceon / google_speech2text.md
Created December 16, 2015 14:49 — forked from alotaiba/google_speech2text.md
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

object VarargTest {
abstract class OptionBase
case class Width(s: String) extends OptionBase
case object HasSearch extends OptionBase
case class Title(s: String) extends OptionBase
implicit def strToOption(s:String) : OptionBase = Title(s)
def func(options: OptionBase*) {
options.foreach(o => println("option = [%s]".format(o)))