Skip to content

Instantly share code, notes, and snippets.

MikimotoH /
Created Aug 16, 2019
ssh tar download exclude directory
ssh johndoe@ "cd ~/project; tar --exclude='./downloads' -zcvf - ." | tar zxvf -
MikimotoH /
Last active Nov 2, 2017
Build Deep Learning Environment on Ubuntu 16.04 (NVIDIA cuDNN and Microsoft CNTK)

Download Proprietary NVIDIA driver for "GeForce GTX 970"


disable nouveau driver

How to disable nouveau kernel driver on Ubuntu 16.04 [ ]

sudo vim /etc/modprobe.d/nvidia-graphics-drivers.conf
sudo vim  /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
sudo apt-get remove nvidia\*
sudo apt-get install dkms build-essential linux-headers-generic
MikimotoH /
Created Aug 8, 2016
use regex to search double quoted string with backslash escaped double quote
In [40]:'"(.*?)(?<!\\)"', r'"abc\" \"def" "ghi"')
Out[40]: <_sre.SRE_Match object; span=(0, 13), match='"abc\\" \\"def"'>
In [41]: print(
abc\" \"def
MikimotoH / gist:6b1ed323ea29b87ad60d88be3084ef35
Created Jun 6, 2016
recover Ubuntu after unmount system disk
View gist:6b1ed323ea29b87ad60d88be3084ef35
我的Ubuntu 14.04.3 LTS Desktop,我把左測的Files -> Devices 中的Ubuntu System disk給 unmount之後,從公司ssh連回家後發現做什麼都
disk i/o write error。
我強迫重開機後,進入黑白的GRUB command line,用了 set prefix=(hda2,2)/boot/grub ; insmod normal ; normal
使用 USB Boot Disk也沒有辦法修復。
後來,我把ubuntu的SSD OCZ 240GB SSD 拆開到另一台電腦,用外接硬碟連接,另一台電腦用也用Ubuntu USB boot,沒想到發現外接SSD
後來,我把那/boot/grub/grub.cfg 中的ro都改成rw,再接回原來的電腦,沒想到就可以用了。
MikimotoH /
Last active May 4, 2019
build vim with python2 python3 YouCompleteMe on Ubuntu 14.04
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=$(python3-config --configdir) \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
MikimotoH /
Created Apr 17, 2016
CAFFE 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)
MikimotoH /
Created Mar 25, 2016
MaxMind "python-geoip" and "python-geoip-geolite2" in Python3.5 version, originally in "~/anaconda3/lib/python3.5/site-packages/"
import sys
import mmap
import socket
import urllib.request, urllib.parse, urllib.error
from threading import Lock
from datetime import datetime
from struct import Struct
MikimotoH / Ubuntu_14.04_tty_is_black
Created Jan 25, 2016
Ubuntu 14.04.3 switching from desktop to tty (Ctrl-Alt-F1) the screen is black
View Ubuntu_14.04_tty_is_black
fix grub resolution:
sudo nano /etc/default/grub
Now, locate the line
MikimotoH / CUDA_driver_version_is_insufficient_for_CUDA_runtime_version.txt
Created Jan 24, 2016
CUDA driver version is insufficient for CUDA runtime version Ubuntu 14.04.3 GTX 970 CUDA 7.5
View CUDA_driver_version_is_insufficient_for_CUDA_runtime_version.txt
Error message "CUDA driver version is insufficient for CUDA runtime version" shown when running
My Equipment:
Ubunt 14.04.3 Trusty
CUDA 7.5
MikimotoH /
Created Sep 21, 2015
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