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
package main | |
import ( | |
"fmt" | |
"os" | |
"bufio" | |
"io/ioutil" | |
) | |
type Page struct { |
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
jupyter notebook --allow-root --ip 0.0.0.0 --port 1024 |
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 | |
set -ex | |
yum update -y | |
yum install gcc-c++ make -y | |
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - | |
yum install -y nodejs |
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
sudo su | |
# Java | |
yum -y install java-1.8.0-openjdk-devel | |
# Build Esentials (minimal) | |
yum -y install gcc gcc-c++ kernel-devel make automake autoconf swig git unzip libtool binutils | |
# Extra Packages for Enterprise Linux (EPEL) (for pip, zeromq3) | |
yum -y install epel-release |
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
Try setting C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files). | |
As Ciro mentioned, CPATH will set the path for both C and C++. | |
export CPLUS_INCLUDE_PATH=/usr/include/python2.7 |
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 sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') |
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
// https://segmentfault.com/a/1190000008293902 | |
#include <stdio.h> | |
#include <stdlib.h> | |
/**************************************** | |
* 函数指针结构体 | |
***************************************/ | |
typedef struct _OP { | |
float (*p_add)(float, float); | |
float (*p_sub)(float, float); |
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 | |
set -ex | |
for drive in $(ls /dev/vd* | grep -v [s-v]da); do | |
mount_dir=/opt/$(basename ${drive}) | |
mkdir -p ${mount_dir} | |
mkfs.ext4 ${drive} | |
blockid=$(blkid ${drive} | cut -d "\"" -f2) | |
echo "UUID=${blockid} ${mount_dir} ext4 defaults 1 2" >> /etc/fstab |
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
# labelencoder 和 onehotencoder 处理测试集中未出现的样本会报错,需要进行处理 | |
import pandas as pd | |
df1 = pd.read_csv("data/xxx.csv", encoding = 'utf-8', error_bad_lines=False, warn_bad_lines=False) | |
df1 = df1.iloc[:, :-1] | |
df1 = df1.drop(['xxx', 'aaa'], axis=1) | |
df1 = df1.fillna('0') | |
# 下面的代码可以直接将 整个 df labelencoder | |
from collections import defaultdict | |
d = defaultdict(LabelEncoder) |
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
# https://zh-google-styleguide.readthedocs.io/en/latest/google-shell-styleguide/environment/ | |
err() { | |
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2 | |
} | |
if ! do_something; then | |
err "Unable to do_something" | |
exit "${E_DID_NOTHING}" | |
fi |