This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = np.arange(10) | |
class Case(): | |
def __init__(self, gcv_pointer): | |
self.gcv = gcv_pointer | |
def gcv(self): | |
return(self.gcv) | |
def gcv_set(self, value): | |
self.gcv[:] = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Book: | |
title = '' | |
pages = 0 | |
def __init__(self, title='', pages=0): | |
self.title = title | |
self.pages = pages | |
def __add__(self, other): | |
"""Control adding two Books together or a Book and a number""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/1395270/determining-memory-usage-of-objects | |
sort( sapply(ls(),function(x){object.size(get(x))})) | |
print(object.size(x=lapply(ls(), get)), units="Mb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//delete from Case unsafe | |
package pocOrientDB; | |
//import com.orientechnologies.*; | |
//import java.io.Console; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.LinkedList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>Date Formats</h3> | |
<table style="width: 100%px;"> | |
<tbody> | |
<tr> | |
<td>Conversion specification</td> | |
<td>Description</td> | |
<td>Example</td> | |
</tr> | |
<tr> | |
<td>%a</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time[R](block: => R): R = { | |
val t0 = System.nanoTime() | |
val result = block // call-by-name | |
val t1 = System.nanoTime() | |
println("Elapsed time: " + (t1 - t0) + "ns") | |
result | |
} | |
// Now wrap your method calls, for example change this... | |
val result = 1 to 1000 sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# =================================== | |
# Experiments with the HBase REST API | |
# =================================== | |
# | |
# <http://hbase.apache.org/docs/r0.20.4/api/org/apache/hadoop/hbase/rest/package-summary.html> | |
# | |
# Usage: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Taken from Karmi via Gist @ gist: 1218928 | |
#!/usr/bin/env bash | |
# | |
# =================================== | |
# Experiments with the HBase REST API | |
# =================================== | |
# | |
# <http://hbase.apache.org/docs/r0.20.4/api/org/apache/hadoop/hbase/rest/package-summary.html> | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package leonteq | |
object FindInRotated { | |
def find(x: Int, arr: Array[Int])/*: Option[Int]*/ = { | |
val splitPoint: Vector[Int] = ((1 to (arr.size - 1)).toVector dropWhile { case i => !(arr(i) < arr(i - 1) | arr(i) == x )}) | |
if (splitPoint.isEmpty) None | |
else { | |
val arrZ = arr.zipWithIndex | |
val headed = arrZ.drop(splitPoint.head) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This demonstrates a trigger for denormalizing a join table into an array. | |
Hasn't really been tested much, but seems to work. | |
Will put it into production tomorrow and see! | |
Maybe PostgreSQL 9.4 will come with arrays of foreign keys. That will remove a lot of the | |
need for simple join tables. | |
http://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys didn't | |
make it into 9.3. |
OlderNewer