Skip to content

Instantly share code, notes, and snippets.

@zhangpengGenedock
zhangpengGenedock / PyCharm change working directory of console Ask
Created October 13, 2017 09:28
PyCharm change working directory of console Ask
Settings -> Build Execution Deployment -> Console -> Python Console
@zhangpengGenedock
zhangpengGenedock / use_apply_in_pandas
Created October 13, 2017 07:12
use_apply_in_pandas
In [43]: df['Value'] = df.apply(lambda row: my_test(row['a'], row['c']), axis=1)
In [44]: df
Out[44]:
a b c Value
0 -1.674308 foo 0.343801 0.044698
1 -2.163236 bar -2.046438 -0.116798
2 -0.199115 foo -0.458050 -0.199115
3 0.918646 bar -0.007185 -0.001006
4 1.336830 foo 0.534292 0.268245
@zhangpengGenedock
zhangpengGenedock / git-checkout-previous-branch
Created October 12, 2017 03:45
git-checkout-previous-branch
git checkout -
或者
git co -
db.gdtask_daily_stats_all_regions_summary.createIndex({"task_id":1, "Region":1},{ unique: true })
@zhangpengGenedock
zhangpengGenedock / waya-dl-setup.sh
Created September 23, 2017 14:09 — forked from mjdietzx/waya-dl-setup.sh
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
@zhangpengGenedock
zhangpengGenedock / mongo_export
Created September 21, 2017 07:55
mongo_export
mongoexport --db mongo_db --collection gdtask_daily_stats --out gdtask_daily_stats.json
@zhangpengGenedock
zhangpengGenedock / min-char-rnn.py
Created September 16, 2017 11:07 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@zhangpengGenedock
zhangpengGenedock / git_remove_track_of_file
Created September 6, 2017 06:07
remove track of file
git rm --cached config-dev.php && git commit -m "config-dev.php"
echo config-dev.php >> .gitignore
git add .gitignore
git commit -m "adding config-dev.php to .gitignore"
@zhangpengGenedock
zhangpengGenedock / account_support_chinese
Created September 1, 2017 02:35
docker 登入account, 支持中文
docker exec -it account env LANG=C.UTF-8 bash
@zhangpengGenedock
zhangpengGenedock / dataframe_add_column_if_not_exist
Last active August 28, 2017 06:58
dataframe_add_column_if_not_exist
if 'Met' not in df:
df['Met'] = df['freqC'] * df['coverage']