A problem is divided into a subproblem, each problem has size n/b
and combine these answers in O(n^d) time.
If T(n) = aT(ceiling(n/b)) + O(n^d) for some constant
a > 0, b > 1, and d >= 0, then
T(n) = O(n^d) if d > log_b a
T(n) = O(n^d log n) if d = log_b a
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 time import strptime, strftime | |
d = "2013-08-12" | |
oldFormat = "%Y-%m-%d" | |
newFormat = "%d-%b-%Y" | |
oldDate = strptime(d, oldFormat) | |
# print oldDate | |
# print strftime(newFormat, oldDate).upper() |
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
# jupyter notebook --no-browser --ip=0.0.0.0 | |
from IPython.core.interactiveshell import InteractiveShell | |
InteractiveShell.ast_node_interactivity = "all" | |
%matplotlib inline | |
%config InlineBackend.figure_format = 'retina' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd |
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 java | |
sudo yum -y update | |
sudo yum -y install java-1.8.0-openjdk-devel | |
sudo update-alternatives --config java | |
sudo update-alternatives --config javac | |
sudo yum -y update |
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 FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n" | |
// usage: | |
docker ps --format="$FORMAT" |
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 | |
# setup nvm node yarn on aws cloud9 | |
set -e | |
cd ~/.nvm | |
git init | |
git remote add origin https://github.com/creationix/nvm.git | |
rm nvm-exec nvm.sh |
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
# eeg_to_spectrogram | |
# steps | |
# 1. read eeg with pyedflib | |
# 2. convert eeg signal to spectrogram using matplotlib | |
# 3. remove unneccesary staff from matplotlib | |
# 4. save a pure spectrogram image for further analysis or | |
# machine learning image classification task |
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
# list available subtitles | |
# https://superuser.com/questions/927523/how-to-download-only-subtitles-of-videos-using-youtube-dl | |
youtube-dl --list-subs https://www.youtube.com/watch?v=lmWh9jV_1ac | |
# download a particular subtitle | |
youtube-dl --write-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac | |
# download auto generated sub | |
youtube-dl --write-auto-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac |
sudo apt-get update
sudo apt-get -y install binutils
git clone https://github.com/aws/efs-utils
cd efs-utils
./build-deb.sh
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
def fibR(n): | |
"""recursive fib""" | |
if n == 0: | |
return 0 | |
if n == 1: | |
return 1 | |
return fibR(n-1) + fibR(n-2) | |
fibR(25) |
OlderNewer