This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Gotcha | |
* | |
* 1. mid = left + (right-left) / 2; | |
* | |
* To prevent overflow during (left+right) | |
* | |
* 2. while(left <= right) | |
* | |
* 3. compare (==) case firstly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install fonts-manchufont | |
sudo apt-get install fonts-noto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import threading | |
import time | |
class XYZ(threading.Thread): | |
def __init__(self): | |
super().__init__() | |
self.val = 0 | |
self.isRunning = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
L = list(range(19)) | |
def da(): | |
d0 = collections.deque() | |
for i in range(100): | |
d0.append(L) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of that Scottish twerp. Bill rebuilding Camelot' - | |
her fairy-talesmileagain - 'and George-' | |
'George picking up the bits,' said Smiley, vamping for | |
her,and they laughed, Smiley falsely. | |
'Give me a kiss, George. Give Connie a kiss.' | |
-- John le Carré |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSH Client | |
# ~/.ssh/config | |
Host gateway | |
HostName gateway.non-exist | |
User qlife | |
ForwardAgent no | |
Compression yes | |
UseKeychain yes # MacOSX specific - to use osx keychain | |
IdentityFile ~/.ssh/__private__key__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for a binary tree node. | |
* struct TreeNode { | |
* int val; | |
* TreeNode *left; | |
* TreeNode *right; | |
* TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
* }; | |
*/ | |
static int __initialSetup = []() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TreeNode: | |
def __init__(self, val, left=None, right=None): | |
self.val = val | |
self.left = left | |
self.right = right | |
def __repr__(self): | |
return 'TreeNode({})'.format(self.val) | |
def deserialize(string): | |
if string == '{}': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "import uuid; print str(uuid.uuid4()).lower()" | python2.7 - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
uuidgen | tr '[:upper:]' '[:lower:]' |
NewerOlder