Skip to content

Instantly share code, notes, and snippets.

@elevine
elevine / gist:be82564f5022139094a4
Created April 28, 2015 20:20
Sync Gateway Crash
2015-04-28T16:18:36.430-04:00 Enabling logging: [CRUD CRUD+ HTTP HTTP+ Access Cache Shadow Shadow+ Changes Changes+]
2015-04-28T16:18:36.433-04:00 ==== Couchbase Sync Gateway/() ====
2015-04-28T16:18:36.434-04:00 Configured Go to use all 8 CPUs; setenv GOMAXPROCS to override this
2015-04-28T16:18:36.434-04:00 WARNING: Error setting MaxFileDescriptors to 5000: Unsupported on Windows -- rest.setMaxFileDescriptors() at config.go:419
2015-04-28T16:18:36.435-04:00 Opening db /db as bucket "sync_gateway", pool "default", server <http://localhost:8091>
2015-04-28T16:18:36.436-04:00 Opening Couchbase database sync_gateway on <http://localhost:8091> as user "sync_gateway"
2015-04-28T16:18:36.596-04:00 Cache: Initializing changes cache with options {CachePendingSeqMaxWait:5s CachePendingSeqMaxNum:10000 CacheSkippedSeqMaxWait:1h0m0s}
2015-04-28T16:18:36.596-04:00 Shadow: Watching doc changes...
2015/04/28 16:18:37 go-couchbase: call to ViewCustom("sync_gateway", "access") in github.com/couchbase/sync_gateway/db.(*Databa
@elevine
elevine / livequery
Created March 9, 2015 18:51
Map used for a LiveQuery that isn't producing changes for deletions
//note, PROP_DELETED is _deleted and PROP_ID is _id
documentView.SetMap((doc, emit) =>
{
if (doc.ContainsKey(PROP_DOCTYPE) && doc[PROP_DOCTYPE].ToString().Equals(DOCTYPE_MYDOC))
{
emit(doc[PROP_ID], doc.ContainsKey(PROP_DELETED) ? doc[PROP_DELETED] : false);
}
}, "1"); // NOTE: don't forget to update the revision number if this method changes!
@elevine
elevine / gist:a25cb722d701702e0f12
Created February 25, 2015 18:03
Couchbase Sync Gateway log showing delays
13:00:01.026023 Enabling logging: [CRUD CRUD+ HTTP HTTP+ Access Cache Shadow Shadow+ Changes Changes+]
13:00:01.028025 ==== Couchbase Sync Gateway/1.0.3(81;fa9a6e7) ====
13:00:01.029028 Configured Go to use all 8 CPUs; setenv GOMAXPROCS to override this
13:00:01.029028 WARNING: Error setting MaxFileDescriptors to 5000: Unsupported on Windows -- rest.setMaxFileDes
criptors() at config.go:378
13:00:01.030025 Opening db /db as bucket "eric_test", pool "default", server <http://localhost:8091>
13:00:01.031023 Opening Couchbase database eric_test on <http://localhost:8091> as user "eric_test"
13:00:01.216004 Cache: Initialized changeCache with nextSequence=#890
13:00:01.217004 Shadow: Watching doc changes...
2015/02/25 13:00:01 go-couchbase: call to ViewCustom("sync_gateway", "access") in github.com/couchbaselabs/sync
private static byte[] AES_Decrypt_block(byte[] cipherText, byte[] Key)
{
// Declare the string used to hold the decrypted text.
byte[] output_buffer = new byte[cipherText.Length];
using (AesManaged aesAlg = new AesManaged())
{
//If CBC, must initialize IV = O_{128}
//aesAlg.Mode = CipherMode.CBC;
//aesAlg.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@elevine
elevine / packages.config
Last active August 29, 2015 14:03
My chocolatey packages.
<packages>
<package id="7zip.commandline" />
<package id="autohotkey.portable" />
<package id="autohotkey_l.portable" />
<package id="ChocolateyGUI" />
<package id="dropbox" />
<package id="fiddler" />
<package id="FoxitReader" />
<package id="mingw-get" />
<package id="NuGet.CommandLine" />
@elevine
elevine / startapp.sh
Last active December 27, 2016 05:44
How to start an Android Activity from adb
adb shell am start -n my.app.package/.path.to.LauncherActivity
adb shell am force-stop my.app.package
@elevine
elevine / mine_coins.sh
Created December 26, 2013 15:59
cgminer script optimized for Gigabyte GV-R928XOC-3GD
#!/bin/sh
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
cd CGMINER_HOME
./cgminer --scrypt -I 13 -g 2 -w 256 --lookup-gap 2 --thread-concurrency 8192 --gpu-engine 1060 --gpu-memclock 1500 --temp-target 70 --auto-fan -o http://<pool-here> -u <username>.<worker> -p <worker password>
@elevine
elevine / ability.rb
Created February 5, 2013 18:01 — forked from watson/ability.rb
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
/**
* Simple GridMousePosition control for OpenLayers
*
* Due to the design of Proj4js and standard grid systems,
* this control uses the included usng.js code instead of a standard
* projection object.
*
* Usage:
*
* map.addControl(new OpenLayers.Control.GridMousePosition(