Skip to content

Instantly share code, notes, and snippets.

@githubutilities
githubutilities / Python-Implementation.md
Last active October 19, 2015 11:46
Python Implementation

Python Implementation

  • pypy - which can be installed through brew install pypy

please refer to here for detail

CPython is the original Python implementation, while pypy is implemented using RPython which is a restricted subset of Python that is amenable to static analysis. For more info, please refer to here at stackoverflow.

  • cython - c implementation of python which can be installed using pip install cython
@githubutilities
githubutilities / Python-Django-CheatSheet.md
Last active October 18, 2015 08:49
Python Django CheatSheet
@githubutilities
githubutilities / MySQL-master-slave-setup.md
Created October 1, 2015 10:29
MySQL Master Slave Setup

MySQL Master Slave Setup

Master-slave replication keeps the data in sync from master to slave.

Master-slave MySQL servers are typically use master for writing data and slave for reading data so the changes that we make are reflected into slave serversin realtime. You can also use master for reading data while using slave for writing data to different tables. For more detail, please refer to here.

@githubutilities
githubutilities / MySQL-master-slave-setup.md
Created October 1, 2015 10:20
MySQL Master Slave Setup

MySQL Master Slave Setup

Master-slave replication keeps the data in sync from master to slave.

Master-slave MySQL servers are typically use master for writing data and slave for reading data so the changes that we make are reflected into slave serversin realtime. You can also use master for reading data while using slave for writing data to different tables. For more detail, please refer to here.

@githubutilities
githubutilities / README.md
Last active September 26, 2015 13:07
Database Normal Form

Database Normal Form

data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF].

3NF vs BCNF

BCNF:

X->Y where Y can be prime or non-prime
@githubutilities
githubutilities / README.md
Created September 18, 2015 06:22
Alfred Features Script

Alfred Features Import Script

# Baidu Search
alfred://customsearch/%E7%99%BE%E5%BA%A6%E4%B8%80%E4%B8%8B/bd/utf8/noplus/https://www.baidu.com/s?wd={query}

# Baidu Pan Search
alfred://customsearch/%E7%99%BE%E5%BA%A6%E7%9B%98/pan/utf8/noplus/http://pan.baidu.com/disk/home#key={query}
@githubutilities
githubutilities / Memory-Management.md
Last active September 18, 2015 14:15
Memory Management

Memory management

Stack and Heap

Each process have its own stack and heap, while threads share common heap.

Static

According to wikipedia, when the program (executable or library) is loaded into memory, static variables are stored in the data segment of the program's address space (if initialized), or the BSS segment (if uninitialized), and are stored in corresponding sections of object files prior to loading.

@githubutilities
githubutilities / FileWorker.md
Created September 11, 2015 01:59
File Worker Objective C

File Worker Objective C

// File Worker
NSFileManager *manager = [NSFileManager defaultManager];
NSString *home = [@"~" stringByExpandingTildeInPath];
NSMutableArray *files = [NSMutableArray arrayWithCapacity:40];

for (NSString *filename in [manager enumeratorAtPath:home]) {
 if ([[filename pathExtension] isEqual:@"png"]) {