Skip to content

Instantly share code, notes, and snippets.

@elevine
elevine / The Technical Interview Cheat Sheet.md
Last active August 25, 2015 19:38 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@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" />
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 / 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
@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: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 / createTable.java
Created August 8, 2011 15:15
Use within an Android SQLiteOpenHelper to generate database tables
/**
* Generates a ddl statement to create a table and executes it
*
* @param db
* @param tablename
* @param columnToType - a mapping of column names to their SQL types in the table
*/
private void createTable(SQLiteDatabase db, String tablename, Map<String,String> columnToType){
StringBuilder builder = new StringBuilder();
builder.append("CREATE TABLE " + tablename +" (");
@elevine
elevine / gist:1245475
Created September 27, 2011 16:00
Couchbase Android Test Application
import com.couchbase.android.CouchbaseMobile;
import com.couchbase.android.ICouchbaseDelegate;
import android.app.Activity;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
public class Main extends Activity {
package com.j256.ormlite.android;
import java.sql.SQLException;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.view.View;
import android.widget.ResourceCursorAdapter;
@elevine
elevine / gist:3239782
Created August 2, 2012 19:02
ActiveRecord establish_connection
#from module ConnectionHandling
def establish_connection(spec = ENV["DATABASE_URL"])
resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new spec, configurations
spec = resolver.spec
unless respond_to?(spec.adapter_method)
raise AdapterNotFound, "database configuration specifies nonexistent #{spec.config[:adapter]} adapter"
end