Skip to content

Instantly share code, notes, and snippets.

View lanceon's full-sized avatar

Oleksiy lanceon

View GitHub Profile
@lanceon
lanceon / readme.txt
Created December 6, 2016 12:13
Windows Git CR/LF issue
# http://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf
git config --global core.autocrlf input
-- ts to unix:
select extract(day from (systimestamp - timestamp '1970-01-01 00:00:00')) * 86400000
+ extract(hour from (systimestamp - timestamp '1970-01-01 00:00:00')) * 3600000
+ extract(minute from (systimestamp - timestamp '1970-01-01 00:00:00')) * 60000
+ extract(second from (systimestamp - timestamp '1970-01-01 00:00:00')) * 1000 unix_timestamp
from dual;
-- unix (millis) to ts:
@lanceon
lanceon / oracle_limits.sql
Created August 10, 2016 10:10
ORA-12516 TNS:listener could not find available handler with matching protocol stack
SELECT * FROM v$resource_limit ORDER BY resource_name;
-- check processes, sessions
select * from v$session
-- check count
-- sqlplus /as sysdba
ALTER SYSTEM SET processes = 80 SCOPE=SPFILE;
ALTER SYSTEM SET sessions = 98 SCOPE=SPFILE;
SHUTDOWN IMMEDIATE
@lanceon
lanceon / lopmonhoc.js.jsx
Created March 18, 2016 18:54 — forked from revskill10/lopmonhoc.js.jsx
Integrate Datatable with React.js
/** @jsx React.DOM */
var LopMonHoc = React.createClass({
getInitialState: function(){
return {data: []}
},
loadData: function(){
$.ajax({
url: '/daotao/lops',
success: function(data){
@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

@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 / 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 / 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'
/**
* 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 / 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: