Skip to content

Instantly share code, notes, and snippets.

View BruceZu's full-sized avatar

Bruce Zu BruceZu

View GitHub Profile
@BruceZu
BruceZu / The Technical Interview Cheat Sheet.md
Created March 29, 2017 19:33 — 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.
@BruceZu
BruceZu / gist:5b14a1d445faf446437189bd9cb3ae0b
Created April 19, 2017 05:42 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
Collecting channels==1.1.2
Using cached channels-1.1.2-py2.py3-none-any.whl
Requirement already satisfied: Django>=1.8 in /home/bzu/project/FortiCloudPlatform/apps/portal/.venv/lib/python3.5/site-packages (from channels==1.1.2)
Requirement already satisfied: asgiref~=1.1 in /home/bzu/project/FortiCloudPlatform/apps/portal/.venv/lib/python3.5/site-packages (from channels==1.1.2)
Collecting daphne>=1.2.0 (from channels==1.1.2)
Using cached daphne-1.2.0-py2.py3-none-any.whl
Requirement already satisfied: six in /home/bzu/project/FortiCloudPlatform/apps/portal/.venv/lib/python3.5/site-packages (from asgiref~=1.1->channels==1.1.2)
Collecting twisted>=17.1 (from daphne>=1.2.0->channels==1.1.2)
Using cached Twisted-17.1.0.tar.bz2
Requirement already satisfied: autobahn>=0.18 in /home/bzu/project/FortiCloudPlatform/apps/portal/.venv/lib/python3.5/site-packages (from daphne>=1.2.0->channels==1.1.2)
@BruceZu
BruceZu / gist:015d178f045fcb51c3ce41f43a0f85ba
Last active May 16, 2017 20:53
with HEAD (5c885c2 ) on branch Dev_1.0, pip failed to install cryptography and twisted.
(.venv) bzu@bruce-laptop:~/project/FortiCloudPlatform/apps$ git branch -av
* Dev_1.0 5c885c2 Merge branch 'Dev_1.0_feature_saml_sso-squashed' into
error message
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -I/home/bzu/project/FortiCloudPlatform/apps/portal/.venv/include/python3.5m -c build/temp.linux-x86_64-3.5/_openssl.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/_openssl.o
build/temp.linux-x86_64-3.5/_openssl.c:12:24: fatal error: pyconfig.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
used for cloud manager

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application

@BruceZu
BruceZu / gist:c13cc3f1c188748c556a2da6aa6d544b
Last active July 4, 2022 05:57
mongodb replica set practise on AWS EC2
Mongo replica set on EC2 directly
@BruceZu
BruceZu / gist:6054cc22ad8a298999013f3edee14330
Last active April 7, 2018 20:36
Mongo replset in docker. Python access and verify Mongo replset.
mongo replica set 3.4.4 local docker engine (bridge)
Map URL to Controller, method, no parameter by far