Skip to content

Instantly share code, notes, and snippets.

View MikimotoH's full-sized avatar

MikimotoH MikimotoH

View GitHub Profile
@MikimotoH
MikimotoH / Cxx_TMP_TestPrimeNumber.cxx
Last active August 29, 2015 14:03
C++TMP to Test Prime Number
template<int N, int D>
struct IsPrimeND{
enum{
ret = (N%D != 0) && IsPrimeND<N, D - 1>::ret
};
};
// template specialization
template<int N>
struct IsPrimeND<N, 1>{
enum{
@MikimotoH
MikimotoH / CxxTmp_Sqrt.cxx
Created July 3, 2014 15:04
C++ Template MetaProgramming to calculate Square Root
template<int N, int i>
struct SqrtM{
enum{
ret = (i*i <= N && (i + 1)*(i + 1) > N)? i : SqrtM<N, i - 1>::ret
};
};
template<int N>
struct SqrtM<N,0>{
@MikimotoH
MikimotoH / build_vim74_huge.sh
Created August 9, 2014 10:26
build vim for YouCompleteMe and Python3
#!/bin/sh
apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
apt-get install python3.4-dev
apt-get install python3-all-dev
apt-get install python-all-dev
hg clone https://code.google.com/p/vim/
cd vim
@MikimotoH
MikimotoH / python_write_unicode_on_cmd
Created December 16, 2014 09:53
python3 windows console (cmd) print unicode
def safeprint(text):
import os,sys
os.write(sys.stdout.fileno(), text.encode(encoding='utf-8'))
sys.stdout.flush()
tt = "思飞通达家电销售管理软件"
safeprint(tt)
@MikimotoH
MikimotoH / mintty_cmd
Created February 17, 2015 23:13
Replace Windows Command prompt (CMD) with mintty.exe
D:\cygwin64\bin\mintty.exe D:\cygwin64\bin\rlwrap %COMSPEC%
# assuming cygwin64 is installed in D driver
@MikimotoH
MikimotoH / Install_Cisco_AnyConnect_on_Mac_OSX_Yosemite_10.10.2
Created April 10, 2015 09:13
Install Cisco AnyConnect on Mac OS X Yosemite (10.10.2)
postflight error because StartupItemContext doesn't exist in /usr/libexec .
Refer to http://www.symantec.com/connect/articles/altiris-agent-mac-support-mac-os-x-10-yosemite
create /usr/libexec/StartupItemContext
*************************************
#!/bin/sh
unset LAUNCHD_SOCKET
exec launchctl bsexec / "$@"
*************************************
@MikimotoH
MikimotoH / vim_python3.sh
Created September 21, 2015 06:47
vim support python3
# python3-config --configdir
./configure --with-features=huge --enable-multibyte --enable-python3interp --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu --enable-rubyinterp --enable-perlinterp --enable-luainterp --enable-cscope --enable-gui=gtk2 --prefix=/usr
make -j4 VIMRUNTIMEDIR=/usr/share/vim/vim74
make clean
@MikimotoH
MikimotoH / CUDA_driver_version_is_insufficient_for_CUDA_runtime_version.txt
Created January 24, 2016 09:25
CUDA driver version is insufficient for CUDA runtime version Ubuntu 14.04.3 GTX 970 CUDA 7.5
Symptom:
Error message "CUDA driver version is insufficient for CUDA runtime version" shown when running
/usr/local/cuda-7.5/samples/1_Utilities/deviceQuery/deviceQuery
My Equipment:
Ubunt 14.04.3 Trusty
EVGA GTX 970
CUDA 7.5
Cause:
@MikimotoH
MikimotoH / Ubuntu_14.04_tty_is_black
Created January 25, 2016 14:13
Ubuntu 14.04.3 switching from desktop to tty (Ctrl-Alt-F1) the screen is black
Resolution:
http://askubuntu.com/questions/508635/how-can-i-get-ttys-to-work-with-nvidia-drivers?lq=1
fix grub resolution:
sudo nano /etc/default/grub
Now, locate the line
#GRUB_GFXMODE=640x480
@MikimotoH
MikimotoH / caffe_pb2.py
Created April 17, 2016 12:18
CAFFE caffe_pb2.py for Python3, modified unicode("...","utf-8") to str("...")
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: caffe.proto
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)