I hereby claim:
- I am xuhang57 on github.
- I am xuhang57 (https://keybase.io/xuhang57) on keybase.
- I have a public key ASDZtjCtXp-eu8ix7SewdhQHIQRiVfstD3xYhWV015a8xAo
To claim this, I am signing this object:
| uname -r | |
| sudo su | |
| # useradd builder | |
| # groupadd builder | |
| cd /home/centos | |
| # Get Source Code | |
| wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.28.3.el7.src.rpm | |
| rpm -ivh kernel-3.10.0-327.28.3.el7.src.rpm | |
| # Build Preparation |
| # https://stackoverflow.com/questions/12179271/meaning-of-classmethod-and-staticmethod-for-beginner/12179325#12179325 | |
| # @classmethod means: when this method is called, we pass the class as the first argument instead of | |
| # the instance of that class (as we normally do with methods). | |
| # This means you can use the class and its properties inside that method rather than a particular instance. | |
| # @staticmethod means: when this method is called, we don't pass an instance of the class to it | |
| # (as we normally do with methods). | |
| # This means you can put a function inside a class but you can't access the instance of that class | |
| # (this is useful when your method does not use the instance) |
| # https://stackoverflow.com/a/33469090/8379419 | |
| # Dependency Injection | |
| # Other people can use your code and inject parents into the method resolution: | |
| class SomeBaseClass(object): | |
| def __init__(self): | |
| print('SomeBaseClass.__init__(self) called') |
I hereby claim:
To claim this, I am signing this object:
| def merge(left, right): | |
| res = [] | |
| i, j = 0, 0 | |
| while i < len(left) and j < len(right): | |
| if left[i] <= right[j]: | |
| res.append(left[i]) | |
| i+=1 | |
| else: | |
| res.append(right[j]) |
| def insertion_sort(arr): | |
| for i in range(1, len(arr)): | |
| cur_val = arr[i] | |
| # indexes of the previous values | |
| j = i-1 | |
| while j>=0 and cur_val < arr[j]: | |
| arr[j+1] = arr[j] | |
| j -= 1 |
| def selection_sort(arr): | |
| for i in range(len(arr)): | |
| min_idx = i | |
| for j in range(i+1, len(arr)): | |
| if arr[min_idx] > arr[j]: | |
| min_idx = j | |
| arr[i], arr[min_idx] = arr[min_idx], arr[i] | |
| return arr |
| def quick_sort(arr): | |
| smaller, equal, greater = [], [], [] | |
| if len(arr) > 1: | |
| pivot = arr[0] | |
| for x in arr: | |
| if x < pivot: | |
| smaller.append(x) | |
| elif x == pivot: | |
| equal.append(x) |
| # String | |
| string = "" | |
| # Tuple | |
| t = tuple() # (), (1,) | |
| # List (Array) | |
| l = [] | |
| # Stack, LIFO |
| # -------- | |
| # Hardware | |
| # -------- | |
| # Opcode - operational code | |
| # Assebly mnemonic - abbreviation for an operation | |
| # Instruction Code Format (IA-32) | |
| # - Optional instruction prefix | |
| # - Operational code |