Skip to content
My dot/config files for macOS, Linux, Raspberry Pi, or WSL
Shell Perl Vim script Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

My dot/config files for macOS, Linux, Raspberry Pi, or WSL

by Sungjin Han


My personal dot/config files for:

  • macOS (Catalina)
  • Raspberry Pi (Raspbian Buster)
  • Linux (Debian/Ubuntu)
  • WSL 1/2 (Windows 10)

0. Easy install

A. Use prep scripts

Prep scripts will clone dot/config files from the repository and install several things automatically.

a. On Linux / Raspberry Pi / WSL

$ cd ~
$ wget -O - "" | bash

It will also install some useful packages.

b. On macOS

$ cd ~
$ wget -O - "" | bash

It will also install Homebrew.

1. Tips for macOS

A. Setup paths

Reorder paths in /etc/paths for convenience:

$ sudo vi /etc/paths

=> put /usr/local/bin on the top for Homebrew


B. How to remove unused Xcode simulators

$ xcrun simctl delete unavailable

2. Tips for Raspberry Pi

A. Useful Configurations

a. Setting up watchdog

$ sudo modprobe bcm2708_wdog
$ sudo vi /etc/modules

then add following line:


Install watchdog and edit conf:

$ sudo apt-get install watchdog
$ sudo vi /etc/watchdog.conf

uncomment following line:

watchdog-device = /dev/watchdog

and restart the service:

$ sudo systemctl restart watchdog

b. Setting up i2c

$ sudo modprobe i2c_dev
$ sudo vi /etc/modules

uncomment following line:


edit blacklist:

$ sudo vi /etc/modprobe.d/raspi-blacklist.conf

and comment out following lines if exist:

blacklist spi-bcm2708
blacklist i2c-bcm2708

Then do the following:

$ sudo apt-get install i2c-tools
$ sudo usermod -a -G i2c USERNAME

B. Additional Configurations

a. WiFi Configuration

i. Add a file on the sdcard and reboot

Create a file named wpa_supplicant.conf with following content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


        # Protocol type can be: RSN (for WP2) and WPA (for WPA1)

        # Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)

        # Pairwise can be CCMP or TKIP (for WPA2 or WPA1)

        # Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)

        # SSID scan technique (0 for broadcast, 1 for hidden)

        # Priority

Replace YOUR-SSID and YOUR-PSK to yours.

YOUR-PSK can be generated like this:

$ wpa_passphrase [SSID] [PASSWORD]

For example,

$ wpa_passphrase my_ssid 0123456789abc

Now put the file on the root of your Raspberry-Pi-ready sdcard and boot with it.

ii. Edit conf file

Do the same on file: /etc/wpa_supplicant/wpa_supplicant.conf.

$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

After that, turn the WLAN device off and on:

$ sudo ifdown wlan0
$ sudo ifup wlan0

Your WLAN device's name may be different from 'wlan0'.

You can list yours with following command:

$ ls /sys/class/net | grep wl

b. UTF-8 configuration for MySQL

Open conf:

$ sudo vi /etc/mysql/my.cnf

and add following lines:

default-character-set = utf8
default-character-set = utf8
init_connect="SET collation_connection = utf8_general_ci"
init_connect="SET NAMES utf8"
character-set-server = utf8
collation-server = utf8_general_ci
default-character-set = utf8

c. AFP & Zero-conf DNS configuration

i. Install netatalk and avahi-daemon
$ sudo apt-get install netatalk
$ sudo apt-get install avahi-daemon
ii. Add an avahi-daemon service

Create a service file:

$ sudo vi /etc/avahi/services/SERVICE_NAME.service

and add following lines:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
    <name replace-wildcards="yes">%h</name>

C. Etc. Tips

a. Set static dns server even when using DHCP

Open conf:

$ sudo vi /etc/dhcp/dhclient.conf

and add following line:

supersede domain-name-servers,;

b. Using bluetooth

1. With on-board bluetooth module
i. Install required packages

Install pi-bluetooth:

$ sudo apt-get install pi-bluetooth

and reboot.

ii. Use bluetoothctl

After reboot, use bluetoothctl for turning up, scanning, and connecting.

$ sudo bluetoothctl

Type help for commands and options.

2. With dongle
i. Make Raspberry Pi discoverable by other bluetooth devices
$ sudo hciconfig hci0 piscan
$ sudo bluetooth-agent 0000

Do as the screen says, and make Raspberry Pi hidden from other bluetooth devices again:

$ sudo hciconfig hci0 noscan
ii. Display bluetooth device (for checking proper installation)
$ hcitool dev
iii. Scan nearby bluetooth devices
$ hcitool scan
iv. Settings

Open conf:

$ sudo vi /etc/default/bluetooth

and add/alter following lines:

# edit

# add static device information
device 01:23:45:AB:CD:EF {
    name "Bluetooth Device Name";
    auth enable;
    encrypt enable;

c. Use logrotate.d

Create a file:

$ sudo vi /etc/logrotate.d/some_file

and add following lines:

  /some_where/*.log {
    rotate 7

d. Mount external hdd/ssd on boot time

Open fstab:

$ sudo vi /etc/fstab

and add following lines:

/dev/some_hdd1  /some/where/to/mount1  ext4  defaults   0 0
/dev/some_hdd2  /some/where/to/mount2  vfat  rw,noatime,uid=7777,gid=7778,user   0 0

uid and gid can be retrieved with command 'id'.

e. Run scripts periodically

$ crontab -e

and add following lines:

# every 5 minutes
*/1 * * * * bash -l /some/
# every 1 hour
0 1 * * * bash -l -c /some/ruby_script_under_rvm.rb

f. Block IPs temporarily with iptables

$ sudo iptables -A INPUT -s 999.999.999.999 -j DROP

Z. Troubleshooting

a. Error message: 'smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped'

Append smsc95xx.turbo_mode=N to /boot/cmdline.txt file, and

add/alter following lines in /etc/sysctl.conf:

#vm.vfs_cache_pressure = 100
vm.vfs_cache_pressure = 300

3. Tips for Linux

A. Make a swap file

$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1M
$ sudo chmod 0600 /swapfile
$ sudo mkswap /swapfile

and append following line to /etc/fstab:

/swapfile swap swap defaults 0 0

B. Install essential packages

$ sudo apt-get install zsh tmux fail2ban nginx

C. Configure locale and timezone

$ sudo apt-get install locales tzdata
$ sudo locale-gen en_US.UTF-8
$ sudo locale-gen ko_KR.UTF-8
$ sudo dpkg-reconfigure tzdata

4. Tips for WSL

A. Prerequisite: Install Chocolatey and WSL

1. Install Chocolatey

As this installation guide says, run PowerShell as administrator, and type following things:

Shell> Set-ExecutionPolicy AllSigned
Shell> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(''))

2. Install WSL

i. WSL

Install WSL and Ubuntu on Windows 10 with this guide.

ii. WSL 2

For WSL 2, read this guide.

B. Install Terminal Emulator for WSL

felixse/FluentTerminal is recommended.

1. How to install fluent-terminal with chocolatey

Shell> choco install fluent-terminal

Z. Trouble Shooting

1. Hash Sum Mismatch on apt-get update

$ sudo rm -rf /var/lib/apt/lists/partial
$ sudo apt-get update -o Acquire::CompressionTypes::Order::=gz

2. cannot allocate memory when forking a new process

Try appending the following line to /etc/sysctl.conf file:

vm.overcommit_memory = 2

You can’t perform that action at this time.