Skip to main content

A Humble Introduction to the Basics of Unicode

Unicode诞生之前——单字节编码 (Single-Byte Encoding)


!"#$%&'()*+,-./0123456789:;<=>[email protected][\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  • 7位二进制编码
  • 32个控制字符
  • 95个可显示字符
  • 基本通用,但经常使用替换和扩展
  • 适合英语的编码方式,但不适合其他语言


  • IBM提出Code Page概念
  • CP437 (Latin US)
  • CP737 (Greek)
  • Apple: Mac OS Roman
  • DEC: Multinational Character Set
  • ISO/IEC 8859
  • … 扩展ASCII种类不计其数

Read more…

A Humble Introduction to the Basics of GDB

What is GDB?

GDB is a user process that attaches on to another user process.

That's all.

Project Build Type

  • Debug build: gcc -g
    • Works with gdb
    • Shows source code
    • Easy mode
  • Release with debug information build:
    • Works with gdb
    • Shows source code, however messy because of optimizations
    • Hard mode
  • Release build: gcc -O2
    • Works with gdb
    • No source code information available
    • Debug with disassembled application
    • Hell mode

Read more…

Ubuntu 14.04 CUDA install

For Ubuntu 16.04 Users:

sudo apt-get -y install nvidia-361-updates-dev nvidia-prime nvidia-profiler \
  nvidia-settings nvidia-visual-profiler \
  nvidia-cuda-dev nvidia-cuda-toolkit nvidia-opencl-dev

And, that's it!

For Ubuntu 14.04 Users

Read more…

Show me the reason: Why did my network fail? (Show error messages from NetworkManager)

The method is for systemd users.

In order to show the error messages printed from your NetworkManager, you need to manually start it from your command line.

Here's the instructions:

systemctl mask NetworkManager.service
systemctl stop NetworkManager.service
NM_PPP_DEBUG=1 /usr/sbin/NetworkManager --no-daemon
systemctl unmask NetworkManager.service
systemctl restart NetworkManager.service

Using one file as Linux Swap instead of a partition

Sometimes wasting a partition for Linux Swap is quite annoying, so let's use a file instead.

Steps are simple:

cd /whatever-dir/
dd if=/dev/zero of=./swapfile bs=1024 count=<num in KB>
mkswap ./swapfile
swapon ./swapfile

# That's it, you just enabled your swapfile

If you'd hope that it'll start at boot, add it to your /etc/fstab:

echo "/whatever-dir/swapfile none swap sw 0 0" >> /etc/fstab

Exchange 'Caps_Lock' and 'Control_L' (Left Control) using xmodmap

The man page of xmodmap is showing us a way of exchanging/swaping Caps_Lock and Control_L:

! file: ~/.xmodmap

! Swap Caps_Lock and Control_L
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

How to run the script:

  1. Save the script in ~/.xmodmap.
  2. Run xmodmap ~/.xmodmap
  3. Check your Caps Lock and Left Control to see the effect.

However, the script will really swap it. Because if you rerun the script again, it'll swap it back.

Read more…