This file contains 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 | |
tmux has-session -t ssh | |
if [ $? != 0 ] | |
then | |
tmux new-session -d -s ssh // 后台新建一个session | |
tmux split-window -h // 切割窗口 | |
tmux select-pane -t 0 // 选择0号窗口 | |
tmux send-keys "ssh zcmlc@host" C-m //向选择的窗口发送指令 | |
tmux send-keys "cd /home/zcmlc/go/src/pro" C-m | |
tmux send-keys "ctl tail -f log" C-m |
This file contains 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
# 设置make命令入口 | |
default_target: all | |
# 静态库build命令 make hello | |
hello: | |
g++ -c MyClass.cpp | |
ar -crv libhello.a MyClass.o | |
# all依赖hello | |
all: hello |
This file contains 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
#include <stdio.h> | |
#include <cuda_runtime.h> | |
#include <helper_cuda.h> | |
#include <iostream> | |
struct Matrix | |
{ | |
int width; | |
int height; | |
float *elements; |
This file contains 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
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> | |
#!/bin/bash | |
# A small example program for using the new getopt(1) program. | |
# This program will only work with bash(1) | |
# An similar program using the tcsh(1) script language can be found | |
# as parse.tcsh | |
# Example input and output (from the bash prompt): | |
# ./parse.bash -a par1 'another arg' --c-long 'wow!*\?' -cmore -b " very long " |
This file contains 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 xavier_init(size): | |
in_dim = size[0] | |
xavier_stddev = 1. / tf.sqrt(in_dim / 2.) | |
return tf.random_normal(shape=size, stddev=xavier_stddev) |
This file contains 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 numpy as np | |
import argparse | |
def main(): | |
parser = argparse.ArgumentParser() | |
# Positional arguments, must be parse | |
parser.add_argument('words', type=str, help='Contents you want to say') | |
# Add argment for enumerable arguments like follow using `choice` keyword | |
This file contains 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
""" | |
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) |
This file contains 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
# 如果是python2需要用cpickle | |
import pickle | |
your_data = {'foo': 'bar'} | |
# Store data (serialize) | |
with open('filename.pickle', 'wb') as handle: | |
pickle.dump(your_data, handle, protocol=pickle.HIGHEST_PROTOCOL) |
This file contains 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 Image | |
import os | |
import os.path | |
import sys | |
path = sys.argv[1] | |
small_path = (path[:-1] if path[-1]=='/' else path) +'_small' | |
if not os.path.exists(small_path): | |
os.mkdir(small_path) | |
for root, dirs, files in os.walk(path): | |
for f in files: |
This file contains 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
## 在python中使用OSTU算法 | |
import matplotlib.pyplot as plt | |
from skimage import data | |
try: | |
from skimage import filters | |
except ImportError: | |
from skimage import filter as filters | |
from skimage import exposure |