Wednesday, November 15, 2017

remove index.php

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

http://www.phpcodify.com/remove-index-php-from-codeigniter-url/

Tuesday, November 14, 2017

nginx

sudo service nginx stop

sudo systemctl restart apache2

Tuesday, July 11, 2017

VM static IP

http://coding4streetcred.com/blog/post/VirtualBox-Configuring-Static-IPs-for-VMs

Monday, July 10, 2017

xorg.conf

afu@afu-denovo:/media/afu/QUICK_DATA/CUDA_SAMPLE/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
02:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)


Section "ServerLayout"
    Identifier     "default"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Module"
SubSection  "extmod"
      Option    "omit XFree86-DGA"   # don't initialise the DGA extension
EndSubSection
# most of these get loaded automatically with the newer Xorgs.
#    Load           "dbe"
#    Load           "glx"
#    Load           "dri"
#    Load           "dri2"
     Load           "extmod"
#    Load           "fbdevhw"
#    Load           "int10"
EndSection

Section "ServerFlags"
    Option         "Xinerama" "1"
    Option         "AutoAddDevices" "False"
    Option         "AutoEnableDevices" "False"
    Option         "AllowEmptyInput" "False"
EndSection

Section "Monitor"
# Samsung TFT Monitor (scr-1.0)
    Identifier     "Samsung0"
    VendorName     "Samsung"
    ModelName      "SyncMaster 2243WM"
    HorizSync       30.0 - 81.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Monitor"
# Samsung TFT Monitor (scr-1.0)
    Identifier     "Samsung1"
    VendorName     "Samsung"
    ModelName      "SyncMaster 2243WM"
    HorizSync       30.0 - 81.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
# primary card
    Identifier     "VideocardA(upperDVI)"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 7100 GS"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
# secondary card
    Identifier     "VideocardB(lowerDVI)"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 7300 SE/7200 GS"
    BusID          "PCI:2:0:0"
EndSection

Section "Device"
# secondary card
    Identifier     "VideocardB(lowerVGA)"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 7300 SE/7200 GS"
    BusID          "PCI:2:0:0"
EndSection

Section "Device"
# primary card
    Identifier     "VideocardA(upperVGA)"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 7100 GS"
    BusID          "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "VideocardA(upperDVI)"
    Monitor        "Samsung0"
    DefaultDepth    24
    Option         "RenderAccel" "On"
    Option         "HWcursor" "On"
    Option         "TwinView" "0"
    Option         "metamodes" "DFP-0: 1680x1050 +0+0"
    Option         "DamageEvents" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "VideocardB(lowerDVI)"
    Monitor        "Samsung1"
    DefaultDepth    24
    Option         "RenderAccel" "On"
    Option         "HWcursor" "On"
    Option         "TwinView" "0"
    Option         "metamodes" "DFP-0: 1680x1050 +0+0"
    Option         "DamageEvents" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
# optional Composite section:
# I dunno if it actually does anything
    Option         "Composite" "Disable"
EndSection

Wednesday, July 5, 2017

install cuda-kits-8.0 with NV driver-381

find . -type f -exec sed -i 's/UBUNTU_PKG_NAME = "nvidia-367"/UBUNTU_PKG_NAME = "nvidia-381"/g' '{}' \;

find . -type f -execdir sed -i 's/UBUNTU_PKG_NAME = "nvidia-367"/UBUNTU_PKG_NAME = "nvidia-381"/g' '{}' \;


pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.1-cp27-none-linux_x86_64.whl

Friday, June 30, 2017

using usb or cd to rescue ruined ubuntu

sudo fdisk -l

find out the disk you want to mount

then

sudo mount /dev/YOUR-DISK /mnt

sudo chroot /mnt

then you have the permission to operate on that disk


text mode

ubuntu@ubuntu:/$ sudo systemctl get-default
graphical.target
ubuntu@ubuntu:/$ sudo systemctl set-default graphical.target
Created symlink from /etc/systemd/system/default.target to /lib/systemd/system/graphical.target.
ubuntu@ubuntu:/$ sudo systemctl get-default
graphical.target


Thursday, June 22, 2017

data structure

sed 's/cv=0/cv=1/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures1.py
sed 's/cv=0/cv=2/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures2.py
sed 's/cv=0/cv=3/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures3.py
sed 's/cv=0/cv=4/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures4.py
sed 's/cv=0/cv=5/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures5.py
sed 's/cv=0/cv=6/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures6.py
sed 's/cv=0/cv=7/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures7.py
sed 's/cv=0/cv=8/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures8.py
sed 's/cv=0/cv=9/g' Stage2_GenerateFeatures0.py > Stage2_GenerateFeatures9.py

mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Allergen/PubMed_IDs
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Autoimm/PubMed_IDs
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Cancer/PubMed_IDs
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Infectious_Disease/PubMed_IDs
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Other/PubMed_IDs
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Transplant/PubMed_IDs

mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Allergen/Training_Sets
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Autoimm/Training_Sets
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Cancer/Training_Sets
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Infectious_Disease/Training_Sets
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Other/Training_Sets
mkdir -p /mnt/BioAdHoc/Users/zfu/2014_Retrain_Classifier/Stage3.Data/Transplant/Training_Sets

sed 's/Features0/Features1/g' Stage3_GenerateFeatures0.sh > Stage3_GenerateFeatures1.sh
sed 's/Features0/Features2/g' Stage3_GenerateFeatures0.sh > Stage3_GenerateFeatures2.sh
sed 's/Features0/Features3/g' Stage3_GenerateFeatures0.sh > Stage3_GenerateFeatures3.sh
sed 's/Features0/Features4/g' Stage3_GenerateFeatures0.sh > Stage3_GenerateFeatures4.sh


sed 's/cv=0/cv=1/g' Stage3_GenerateFeatures0.py > Stage3_GenerateFeatures1.py
sed 's/cv=0/cv=2/g' Stage3_GenerateFeatures0.py > Stage3_GenerateFeatures2.py
sed 's/cv=0/cv=3/g' Stage3_GenerateFeatures0.py > Stage3_GenerateFeatures3.py
sed 's/cv=0/cv=4/g' Stage3_GenerateFeatures0.py > Stage3_GenerateFeatures4.py