Skip to content

Instantly share code, notes, and snippets.

View greglu's full-sized avatar

Greg Lu greglu

  • Swoop.com
  • San Diego, CA
View GitHub Profile
max_function = ""
6.times do |i|
6.times do |j|
max_function << ((rand(2) == 1) ? " + " : " - ")
max_function << "#{rand(20)}*x#{i+1}#{j+1}"
end
end
puts ((max_function[0..2] == " + ") ? max_function[3..(max_function.size-1)] : max_function)
http://books.google.com/books?id=8lKyxS8_CNoC&lpg=PA196&ots=G-ZgzDfG_0&dq=pushdown%20automata%20complement%20of%20ww&pg=PA163#v=onepage&q=ww&f=false
hbase(main):051:0> get 'books', 'fe80a1eb-2b3c-4995-8630-4131ef4b4eb7'
COLUMN CELL
attribute:author timestamp=5410348784985219840, value=\001Richard Matheson
attribute:description timestamp=5410348784985219840, value=\001The most clever and riveting vampire nov
el since Dracula.
attribute:links timestamp=5410348784985219840, value=--- []\n\n
attribute:title timestamp=5410348784985219840, value=\001I Am Legend
log:change timestamp=5410348784985219840, value=--- []\n\n
5 row(s) in 0.0070 seconds
public class Timestamp {
/**
* Convert the given date in hbase timestamp format.
* @param date to convert
* @return the timestamp
*/
public static long toHbaseTimestamp(Date date) {
return ((date.getTime() / 1000) << 32) + ((date.getTime() % 1000) * 1000);
}
09/12/22 14:58:27 INFO ipc.HBaseServer: IPC Server handler 39 on 60020: starting
09/12/22 14:58:27 INFO regionserver.HRegionServer: HRegionServer started at: 192.168.1.122:60020
09/12/22 14:58:27 INFO regionserver.StoreFile: Allocating LruBlockCache with maximum size 408.3m
09/12/22 14:58:27 INFO regionserver.HRegionServer: MSG_CALL_SERVER_STARTUP
09/12/22 14:58:27 INFO regionserver.HLog: HLog configuration: blocksize=67108864, rollsize=63753420, enabled=true, flushlogentries
=100, optionallogflushinternal=10000ms
09/12/22 14:58:27 INFO regionserver.HLog: New hlog /hbase/amsterdam_factory/.logs/factory22.local,60020,1261511907495/hlog.dat.126
1511907500
09/12/22 14:58:27 INFO regionserver.HRegionServer: Telling master at 192.168.1.101:62000 that we are up
09/12/22 14:58:27 FATAL regionserver.HRegionServer: Unhandled exception. Aborting...
-- This was for a DB class. Don't judge me.
mysql> SELECT * FROM Project;
+-----+-----------+------+
| pid | startyear | cid |
+-----+-----------+------+
| 1 | 2007 | 5 |
| 2 | 2004 | 29 |
| 3 | 2004 | 1 |
| 4 | 2003 | 14 |
development:
adapter: cassandra
keyspace: development
servers: localhost:9160
test:
adapter: cassandra
keyspace: test
servers: localhost:9160
production:
adapter: cassandra
> db.runCommand( { listshards : 1 } );
{
"shards" : [
{
"_id" : "node02",
"host" : "node02/node02.lab.mtl:27020,node03.lab.mtl:27020"
},
{
"_id" : "node04",
"host" : "node04/node04.lab.mtl:27020,node05.lab.mtl:27020"
// shard_test.js
// we want a lot of data, so lets make a ~50k string to cheat :)
bigString = "";
while ( bigString.length < 50000 )
bigString += "this is a big string. ";
print( "my big string is: " + bigString.length + " characters long" );
// ok, now lets insert a some data
var num = 1;