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
https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91 | |
sudo apt-get update -y && \ | |
sudo apt-get upgrade -y && \ | |
sudo apt-get dist-upgrade -y && \ | |
sudo apt-get install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt-get update -y && \ | |
sudo apt-get install gcc-7 g++-7 -y && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-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
CREATE TEMPORARY FUNCTION do(x float64, y float64) | |
RETURNS float64 | |
LANGUAGE js AS """ | |
function add(a, b) { | |
return a + b; | |
} | |
return add(x, y) | |
"""; | |
with data as ( | |
select * |
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
for idx in range(3,351): | |
tablename = "table_{0}".format(idx) | |
print(tablename) | |
!bq rm -f -t $tablename |
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 cosine_distances(X, Y): | |
""" | |
X : Target example score vector DataFrame with inst_id as the first column | |
Y : All example score vector DataFrame with inst_id as the first column | |
return pair-wise cosine distance DataFrame | |
""" | |
from sklearn.metrics import pairwise | |
x_header = X.iloc[:, 0].values | |
X = X.iloc[:, 1:] | |
y_header = Y.iloc[:, 0].values |
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 predict_score(model_pickle_path, target_filepath, n_meta_columns, n_feature_columns): | |
""" | |
model_pickle_path : | |
target_filepath : target gene expression examples with meta | |
n_meta_columns : number of meta columns | |
n_feature_columns : number of feature(gene)s | |
return score DataFrame | |
""" | |
df0 = pd.read_csv(target_filepath, header=-1) | |
x_header = df0.iloc[:, 0:n_meta_columns] |
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 concurrent.futures | |
def do(params): | |
return "hello" | |
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: | |
future = executor.submit(do, params) | |
for future in concurrent.futures.as_completed(future_to_url): | |
url = future_to_url[future] |
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
device_name = tf.test.gpu_device_name() | |
if device_name != '/device:GPU:0': | |
raise SystemError('GPU device not found') | |
print('Found GPU at: {}'.format(device_name)) | |
print("GPU Available: ", tf.test.is_gpu_available()) |
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
# Default nohup.out | |
nohup myprogram & | |
# Custom output file | |
nohup myprogram > myprogram.out & | |
# Redirect stderr to stdout | |
nohup myprogram > myprogram.out 2>&1 & | |
# Multiple commands |
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
find . -type f -name "*.bak" -delete | |
or | |
find . -name "FILE-TO-FIND" -exec rm -rf {} \; |
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
# Install python | |
RUN apt-get update \ | |
&& apt-get install -y python3-pip python3-dev git \ | |
&& cd /usr/local/bin \ | |
&& ln -s /usr/bin/python3 python \ | |
&& pip3 install --upgrade pip |
OlderNewer