sudo adduser ubuntu
sudo su ubuntu
cd /home/ubuntu
mkdir .ssh
chmod 700 .ssh
cd .ssh
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
# if not root, find parent, set parent, return parent | |
p = map(chr, range(n)) | |
def find(p, x): | |
if p[x] != x: | |
p[x] = find(p, p[x]) | |
return p[x] | |
def union(p, i, j): | |
pi, pj = find(p, i), find(p, j) |
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
id | difficulty | title | |
---|---|---|---|
253 | Medium | Meeting Rooms II | |
269 | Hard | Alien Dictionary | |
681 | Medium | Next Closest Time | |
159 | Hard | Longest Substring with At Most Two Distinct Characters | |
642 | Hard | Design Search Autocomplete System | |
158 | Hard | Read N Characters Given Read4 II - Call multiple times | |
683 | Hard | K Empty Slots | |
716 | Easy | Max Stack | |
755 | Medium | Pour Water |
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
from collections import defaultdict | |
class Solution(object): | |
def alienOrder(self, words): | |
""" | |
:type words: List[str] | |
:rtype: str | |
""" | |
graph = defaultdict(list) | |
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
# . set_gopath.sh | |
export GOPATH=`pwd` | |
export PATH="$GOPATH/bin:$PATH" | |
# for mac osx | |
# export GOBIN=$GOPATH/bin | |
# unset if `flogo build` | |
git config --global --unset alias.gb |
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 io | |
import re | |
import sys | |
import collections | |
if len(sys.argv) != 7: | |
print(sys.argv[0] + " <base_dict> <base_lm> <ext_dict> <ext_lm> <merged_dict> <merged_lm>") | |
sys.exit(2) | |
[basedic, baselm, extdic, extlm, outdic, outlm] = sys.argv[1: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/bash | |
outputdir="../audio-8k" | |
mkdir -p $outputdir | |
for file in **/*.wav | |
do | |
filename=$(basename $file) | |
dir=$(dirname $file) | |
echo $dir | |
outputfile="${outputdir}/${file}" | |
mkdir -p $(dirname $outputfile) |
For gcloud:
- Specified protocols and ports > Enter
tcp:<PORT-NUMBER>
for this field if this is the page you see. - Targets > All instances in the network.
- Allowed protocols and ports
For others:
- Specify ip port if you want to expose one
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
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} | |
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
sudo ldconfig /usr/local/cuda/lib64 |
based on pyimagesearch tutorial
- install XCode, homebrew
- install python3:
brew install python3
brew linkapps python3
- if existing virtual environment is installed, activate it
- else activate new virtualenv
cv
(usingvirtualenvwrapper
):