Skip to content

Instantly share code, notes, and snippets.

@eazybit
eazybit / CouchToMySQL.py
Last active August 29, 2015 14:04
[Python] - Get changes from couchdb and save the changes into mysql database. Very small sample code that can only handle the new data.
#!/usr/bin/python
# Filename : hello.py
# Author: Yu Zhang, zyu.1106@gmail.com, www.yu-zhang.net
import couchdb
import time
import json
import MySQLdb
_host='localhost'
@eazybit
eazybit / FindTopFive.cpp
Last active August 29, 2015 14:04
[C++] - Find 5 words with highest frequency in a text file
///////////////////////////////////////////////////////////////////////////
// FindTopFive.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/08/02/interview-question-c-find-5-words-with-highest-frequency-in-a-text-file///
@eazybit
eazybit / FindCombinationMatching.cpp
Created August 2, 2014 07:04
[C++] - Find combination of strings matched with a pattern
///////////////////////////////////////////////////////////////////////////
// FindCombinationMatching.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: //
@eazybit
eazybit / RemoveNode.cpp
Last active August 29, 2015 14:04
[C++] - Remove nodes in linked list
///////////////////////////////////////////////////////////////////////////
// RemoveNode.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/08/01/interview-question-c-remove-nodes-in-linked-list///
@eazybit
eazybit / CopyString.cpp
Last active August 29, 2015 14:04
[C++] - Copy a char* string without using liarary functions
///////////////////////////////////////////////////////////////////////////
// CopyString.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/08/01/interview-question-copy-a-string///
@eazybit
eazybit / AVLTree.cpp
Created August 2, 2014 00:03
[C++] - Sort 3 dimensional points according to their distance to the first point
///////////////////////////////////////////////////////////////////////////
// AVLTree.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: //
INC=/usr/local/ssl/include/
LIB=/usr/local/ssl/lib/
all:
gcc -I$(INC) -L$(LIB) -o vpn_client vpn_client.c -lssl -lcrypto -ldl -fpermissive
@eazybit
eazybit / FindFirstDuplicate.cpp
Last active August 29, 2015 14:04
[C++] - Find first duplicate in an integer array
///////////////////////////////////////////////////////////////////////////
// FindFirstDuplicate.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: http://www.yu-zhang.net/blog/2014/07/31/interview-question-c-find-first-duplicate-in-an-array///
@eazybit
eazybit / Constants.h
Created July 31, 2014 02:27
[C++] - Given a dictionary and a M*N matrix with random letters. Find all the words from the matrix.
///////////////////////////////////////////////////////////////////////////
// Constants.h //
// ver 1.0 //
// Type: header file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: Header file for class constant, define some useful const //
@eazybit
eazybit / FindUniqueGasStationUsingMap.cpp
Created July 30, 2014 21:21
[C++] - Find unique gas stations along a street using map
///////////////////////////////////////////////////////////////////////////
// FindUniqueGasStationUsingMap.cpp //
// ver 1.0 //
// Type: source file //
// Language: C++ //
// Platform: Dell Alienware M14x, Win8 //
// Author: Yu Zhang, Syracuse University //
// zyu.1106@gmail.com //
// yzhan39@syr.edu //
// Description: //