tools - modrpc/info GitHub Wiki

Table of Contents

Microsoft Windows

  • ctrl-shift-esc: open task manager
  • windows-x: pops up system menu

Coding Skills

C/C++

Development Tools

QEMU

Autotools

Autoconf

  • Used to generate a configuration script for a project

Automake

  • Used to simplifiy the process of creating consistent and functional makefiles

Libtool

Git

git gc --aggressive --prune
git repack -a -d --depth=250 --window=250  # takes longer
  • how to remove all history
Deleting the .git folder may cause problems in your git repository. 
If you want to delete all your commit history but keep the code in 
its current state, it is very safe to do it as in the following:

Checkout

git checkout --orphan latest_branch
Add all the files

git add -A
Commit the changes

git commit -am "commit message"
Delete the branch

git branch -D master
Rename the current branch to master

git branch -m master
Finally, force update your repository

git push -f origin master
PS: this will not keep your old commit history around

GDB

  • set $tmp = <somevalueorexpr></somevalueorexpr>
  • How GDB works: https://blog.0x972.info/?d=2014/11/13/10/40/50-how-does-a-debugger-work
  • Linux ptrace API: allows other (debugger) process to access another process e.g.
    • read/write debugged process's memory: PTRACE_PEEKTEXT, PTRACE_POKE, ...
    • read/write debugged process's CPU registers
    • notified of system events
    • control debugged process's execution: PTRACE_SIGNLESTEP, PTRACE_INTERRUPT, PTRACE_CONT, etc.
    • alter its signal handling: PTRACE_SET_SIGINFO, etc.

Performance Tools

SysStat Toolset

sudo apt-get install sysstat
  • vmstat:
  • iostat:
  • mpstat:

NETHOG: Network bandwidth monitor

sudo apt install nethogs
sudo nethogs wlan0

Memory query

  • free -m

Ubuntu Installation

  • Swap Ctrl-CapsLock:
$ sudo apt install gnome-tweak-tool
$ gnome-tweaks
=> Gnome Tweaks -> Keyboard & Mouse -> Additional Layout Options -> Caps Lock key behavior.

Acrobat reader

sudo apt install gdebi-core libxml2:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libatk-adaptor:i386
wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb:

Linux

System Info

Shell scripting

Periodical commands

for i in {1..10}; do echo -n "This is a test in loop $i "; date ; sleep 5; done

/proc file system

  • /proc/pid

Shared library debugging

  • export LD_DEBUG=files
  • export LD_DEBUG=bindings
  • export LD_DEBUG=libs

Terminals

Services

  • systemctl
$ sudo systemctl list-units -t service |grep emby
$ sudo service emby-server stop
  • MongoDB example
cd /lib/systemd/system/
vim mongod.service
# contents
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual

[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

Network

DNS

  • dig -p 5353 @224.0.0.251 _ssh._tcp.local ptr

NMCLI

  • nmcli
    • nmcli device wifi list
  • UDP multicast checking
    • For each receiver (i.e. server) do netstat &#45;gn
    • if it doesn't show the multicast address that you subscribed, it means that the server failed to joined the group.
    • if failed to join, it's either server or kernel setting

TCPDUMP

  • tcpdump dumps traffic on network

Network performance analysis

  • iperf: https://iperf.fr
    • UDP packet loss in RPI 2: https://github.com/raspberrypi/linux/issues/707
    • UDP packet test:
      • Server: iperf -s -u -i 1
      • Ciient: iperf -c <servername></servername> -r -u -b 10M (10Mbps testing; try 20 ~ 100 Mbps)
    • Multicast testing
      • Servers: run several servers with the bind option (-B, --bind) set to the multicast group address:
        • iperf -s -u B 224.0.0.251 -i 1 (multiple servers)
      • Client: iperf -c 224.0.67.67 -u --ttl 5 -t 5

modrpc.io

  • Cloudflare.com (cjeongkr:aintel): Free DNS provider

VPN

Database

MySQL

Security

ssh login without password

ssh-keygen -t rsa
ssh b@B mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
ssh b@B

Media Servers

Linux portable hard drive setup for Plex

sudo blkid
  #/dev/sda2: UUID="c0fba059-c2f3-43c4-9aca-cf1e03ec594d" TYPE="ext4"
  #/dev/sda3: UUID="022113f6-b76c-4970-a3b8-db465c33ae5d" TYPE="swap"
  #/dev/sdb1: LABEL="Seagate Expansion Drive" UUID="4AD86C68D86C53EB" TYPE="ntfs"
sudo vi /etc/fstab
  #UUID=4AD86C68D86C53EB /media/external ntfs-3g defaults,uid=1000,gid=1000,umask=0022,fmask=0133 0 0

Ubuntu

WSL (Windows)

GRUB bootloader troubleshooting

Hangul

$ sudo apt-get install language-pack-ko
$ sudo apt-get install korean*
$ sudo apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core
$ sudo apt-get install fonts-nanum-coding
$ fc-cache -r 

Latex

Hangul

  • sudo apt-get install xzdec
  • see doc/memo/finance-basics file for example
  • file must be in UTF-8 Unicode text format (not ISO-8859 text; do "file <file></file>" to check)
  * changing from ISO-8859-1 to UTF-8
iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file

Acrobat Reader

  sudo dpkg --add-architecture i386
  sudo apt install libxml2:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libatk-adaptor:i386 libgdk-pixbuf2.0-0:i386
  wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb
  sudo dpkg -i AdbeRdr9.5.5-1_i386linux_enu.deb

Minion Font

  • getting otf fonts
sudo apt-get install lcdf-typetools
  • Install acrobat reader so that you can get minion font Fonts are installed with Adobe Acrobat Reader, for example: otfinfo -v /opt/acrobat/Resource/Font/MinionPro-Regular.otf This should result in Version 2.015;PS 002.000;Core 1.0.38;makeotf.lib1.7.9032.
  sudo add-apt-repository "deb http://archive.canonical.com/ precise partner"
  sudo apt-get update
  sudo apt install adobereader-enu
  • MinionPro installation
  wget ftp://ftp.kaist.ac.kr/tex-archive/fonts/minionpro/scripts.zip 
  wget ftp://ftp.kaist.ac.kr/tex-archive/fonts/minionpro/enc-2.000.zip 
  wget ftp://ftp.kaist.ac.kr/tex-archive/fonts/minionpro/metrics-base.zip
  unzip scripts.zip
  cp /opt/acrobat/Resource/Font/MinionPro* otf
  ./convert.sh
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/type1/adobe/MinionPro
  sudo cp pfb/*.pfb `kpsexpand '$TEXMFLOCAL'`/fonts/type1/adobe/MinionPro
  sudo unzip -d `kpsexpand '$TEXMFLOCAL'` metrics-base.zip
  sudo unzip -d `kpsexpand '$TEXMFLOCAL'` enc-2.000.zip
  sudo texhash
  sudo updmap-sys --enable Map MinionPro.map
  `
```  
* MnSymbol installation
```sh
  wget ftp://ftp.kaist.ac.kr/pub/tex-archive/fonts/mnsymbol.zip
  unzip mnsymbol.zip
  cd mnsymbol/tex
  latex MnSymbol.ins
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/tex/latex/MnSymbol
  sudo cp MnSymbol.sty `kpsexpand '$TEXMFLOCAL'`/tex/latex/MnSymbol
  cd ..
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/source/public/MnSymbol
  sudo cp -R source/* `kpsexpand '$TEXMFLOCAL'`/fonts/source/public/MnSymbol
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/doc/latex/MnSymbol
  sudo cp MnSymbol.ps MnSymbol.pdf README `kpsexpand '$TEXMFLOCAL'`/doc/latex/MnSymbol
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/map/dvips/MnSymbol
  sudo cp enc/MnSymbol.map `kpsexpand '$TEXMFLOCAL'`/fonts/map/dvips/MnSymbol
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/enc/dvips/MnSymbol
  sudo cp enc/*.enc `kpsexpand '$TEXMFLOCAL'`/fonts/enc/dvips/MnSymbol
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/type1/public/MnSymbol
  sudo cp pfb/*.pfb `kpsexpand '$TEXMFLOCAL'`/fonts/type1/public/MnSymbol
  sudo mkdir -p `kpsexpand '$TEXMFLOCAL'`/fonts/tfm/public/MnSymbol
  sudo cp tfm/* `kpsexpand '$TEXMFLOCAL'`/fonts/tfm/public/MnSymbol
  sudo texhash
  sudo updmap-sys --enable MixedMap MnSymbol.map
  • Myriad installation
cp /opt/acrobat/Resource/Font/MyriadPro-* otf/
./convert.sh
wget faq.ktug.or.kr/wiki/uploads/MyriadProAR7.pdf faq.ktug.or.kr/wiki/uploads/MyriadProAR7.zip
mkdir myriad
cd myriad
unzip ../MyriadProAR7.zip
mv fonts/tfm/Adobe fonts/tfm/adobe
mv fonts/type1/Adobe fonts/type1/adobe
mkdir fonts/enc
mv dvips fonts/enc/
mkdir -p fonts/map/dvips/Myriad
mv fonts/enc/dvips/MyriadPro/MyriadPro.map fonts/map/dvips/Myriad/
cp ../pfb/MyriadPro-* fonts/type1/adobe/MyriadPro
sudo cp -R * `kpsexpand '$TEXMFLOCAL'`
sudo texhash
sudo updmap-sys --enable Map MyriadPro.map
  • To use
  \usepackage[T1]{fontenc}
  \usepackage{textcomp}
  % Minion and Myriad fonts
  \usepackage[minionint,mathlf]{MinionPro}
  \renewcommand{\sfdefault}{Myriad-LF}

한글 인코딩 문제

for f in *.py
do
  echo "$f"
  iconv -f CP949 -t UTF-8 $f -o tmp/$f
  echo "$(tail -n + 3 $f)" > $f
done
⚠️ **GitHub.com Fallback** ⚠️