Skip to content

Instantly share code, notes, and snippets.

#!/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
@yijia2413
yijia2413 / c_callback_func.c
Created September 3, 2018 02:17
c_callback_func
// https://segmentfault.com/a/1190000008293902
#include <stdio.h>
#include <stdlib.h>
/****************************************
* 函数指针结构体
***************************************/
typedef struct _OP {
float (*p_add)(float, float);
float (*p_sub)(float, float);
@yijia2413
yijia2413 / test.py
Created August 3, 2018 02:44
python utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
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
@yijia2413
yijia2413 / tf_serving.sh
Created January 19, 2018 05:56 — forked from jarutis/tf_serving.sh
Install Tensorflow Serving on Centos 7 (CPU)
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
@yijia2413
yijia2413 / install_node.sh
Created January 6, 2018 07:54
install node and npm
#!/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
jupyter notebook --allow-root --ip 0.0.0.0 --port 1024
@yijia2413
yijia2413 / read_write.go
Created December 26, 2017 12:42
go read write example
package main
import (
"fmt"
"os"
"bufio"
"io/ioutil"
)
type Page struct {
@yijia2413
yijia2413 / vagrantfile
Created December 13, 2017 15:07
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@yijia2413
yijia2413 / basic.vimrc
Created December 13, 2017 14:59
vimrc
set nu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 6.0 - 01/04/17 14:24:34
"
" Blog_post: