Skip to content

Instantly share code, notes, and snippets.

@scalabl3
scalabl3 / PNMessage.m
Last active August 29, 2015 14:02
PubNub Objective-C Subscribe to Channel and Add Receive Observer
// Message Receive Event for All Subscribed Channels
- (void)pubnubClient:(PubNub *)client didReceiveMessage:(PNMessage *)msg
{
NSLog(@"Message Received:\n Channel:%@\n Message:%@", msg.channel.name, [msg message]);
}
- (void) subscribeToChannel:(NSString*)channelName
{
PNChannel* channel = [PNChannel channelWithName:channelName];
@scalabl3
scalabl3 / redis-server
Last active August 29, 2015 13:59
Redis init.d Centos
#!/bin/sh
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis-server
# pidfile: /var/run/redis_6379.pid
@scalabl3
scalabl3 / redis.conf
Last active December 8, 2015 06:43
Redis Conf
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
@scalabl3
scalabl3 / gist:10476402
Created April 11, 2014 15:07
yum update for libcouchbase...
Resolving Dependencies
--> Running transaction check
---> Package libcouchbase-devel.x86_64 0:2.2.0-1 will be updated
---> Package libcouchbase-devel.x86_64 0:2.3.0-1 will be an update
---> Package libcouchbase2-core.x86_64 0:2.2.0-1 will be updated
---> Package libcouchbase2-core.x86_64 0:2.3.0-1 will be an update
---> Package libcouchbase2-libevent.x86_64 0:2.2.0-1 will be updated
---> Package libcouchbase2-libevent.x86_64 0:2.3.0-1 will be an update
--> Finished Dependency Resolution
Error: Multilib version problems found. This often means that the root
@scalabl3
scalabl3 / gist:9768228
Last active August 29, 2015 13:57
Maven pom.xml
<dependencies>
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>couchbase-client</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@scalabl3
scalabl3 / gist:8046965
Last active September 26, 2019 12:09
Install Elasticsearch 90.5 for Couchbase Integration on Mac via homebrew
These instructions are on Mac OS X, but it can easily be translated for any linux os too. The only differences will be to use default in elasticsearch.yml for vbuckets of 1024 (comment or take that line out). Also the paths to plugins, config, bin, etc. might be different as far as copying the couchbase_template.json over to config/templates.

On Mac I highly recommend just permanently increasing the max number of file descriptors allowed (unlimited is no longer a valid parameter):

$ cd /etc
$ vi launchd.conf
$ limit maxfiles 1000000 1000000

This Rules

This also Rules

What?

This text is bold this is italic and this is bold italic.

  • List 1
  • List 2
    • List 3
  • List 4
@scalabl3
scalabl3 / gist:7235173
Last active December 27, 2015 00:08
Using a Timestamp as a Key for future Notifications

Notification Document

KEY: 10/31/2013::20:00

{
    "email": [
        { "uid": 1029, "content_id": "c::2822020", "type": "halloween" }
        { "uid": 2058, "content_id": "c::2822020", "type": "halloween" }
 ],
jasdeep @JumboJet : ~/rvm/gems/ruby-1.9.3-p194/gems/couchbase-1.2.3/ext/couchbase_ext $ cat mkmf.log
"gcc-4.2 -o conftest -I/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin12.0.0 -I/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/usr/local/opt/libevent/include -I/usr/local/include -I/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/include -I/Users/jasdeep/rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe -std=c99 -Wall -Wextra conftest.c -L. -L/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/lib -L/usr/local/opt/libevent/lib -L/usr/local/lib -L/Users/jasdeep/rvm/rubies/ruby-1.9.3-p194/lib -L/usr/lib -L/Users/jasdeep/rvm/usr/lib -L. -lruby.1.9.1 -lpthread -ld
$ brew uninstall libcouchbase && brew install libcouchbase
Uninstalling /usr/local/Cellar/libcouchbase/2.0.3...
==> Downloading http://packages.couchbase.com/clients/c/libcouchbase-2.0.5.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/libcouchbase/2.0.5 --disable-examples --disable-tests --disable-couchbasemock
==> make install
🍺 /usr/local/Cellar/libcouchbase/2.0.5: 105 files, 912K, built in 47 seconds
jasdeep @JumboJet : /Dropbox/AmazonServer/rockstrs_com/vertx-api [master] $ gem install couchbase
Fetching: couchbase-1.2.3.gem (100%)
Building native extensions. This could take a while...