Posts

Mac terminal environment setup - zsh + Powerline + tmux

Image
Mac terminal environment setup - zsh + Powerline + tmux Powerline font Install nerd-font or powerline font . Nerd-font brew tap homebrew/cask-fonts brew cask install font-hack-nerd-font Powerline fonts # clone git clone https://github.com/powerline/fonts.git --depth = 1 # install cd fonts ./install.sh # clean-up a bit cd .. rm -rf fonts Oh My Zsh Install Zsh. brew install wget sh -c " $( wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O - ) " Change default zsh theme. You can see all the themes here or using powerlevel10k theme . ohmyzsh themes vim ~/.zshrc > ZSH_THEME = "agnoster" powerlevel10k theme brew install romkatv/powerlevel10k/powerlevel10k echo 'source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc After setup, enter the following command to apply the configuration. exec $SHELL Insecure Problme fix: # [oh-my-zsh] Insecure completio...

Understanding htop value

Image
Understanding htop value htop columns meaning Here is a list that explains what each column means. PID: A process’s process ID number. USER: The process’s owner. PRI: The process’s priority. The lower the number, the higher the priority. NI: The nice value of the process, which affects its priority. VIRT: How much virtual memory the process is using. RES: How much physical RAM the process is using, measured in kilobytes. SHR: How much shared memory the process is using. S: The current status of the process (zombied, sleeping, running, uninterruptedly sleeping, or traced). %CPU: The percentage of the processor time used by the process. %MEM: The percentage of physical RAM used by the process. TIME+: How much processor time the process has used. COMMAND: The name of the command that started the process. The difference between VIRT, RES and SHR VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it ...

Turn off System Integrity Protection on your Mac

Image
Turn off System Integrity Protection on your Mac What is System Integrity Protection OS X El Capitan and later includes security technology that helps protect your Mac from malicious software. System Integrity Protection restricts the root user account and limits the actions that the root user can perform on protected parts of the Mac operating system. System Integrity Protection includes protection for these parts of the system: /System /usr /bin /sbin /var Apps that are pre-installed with OS X Paths and apps that third-party apps and installers can continue to write to include: /Applications /Library /usr/local System Integrity Protection is designed to allow modification of these protected parts only by processes that are signed by Apple and have special entitlements to write to system files, such as Apple software updates and Apple installers. Apps that you download from the Mac App Store already work with System Integrity Protection. How to turn off ...

How to Change the Time Zone on Ubuntu

Image
How to Change the Time Zone on Ubuntu Change timezone ## show current time timedatectl ## show timezone ls -l /etc/localtime ## list timezones timedatectl list-timezones ## sudo timedatectl set-timezone <your_time_zone> sudo timedatectl set-timezone Asia/Taipei timedatectl Reference: how to set or change timezone in linux

Get request ip address using express in Nodejs

Image
Get request ip address using express in Nodejs Here’s the way to get the x-forward-for head var ip = req . headers [ 'x-forward-for' ] make sure all the keyword is lower case!! It took me half a day to find this mistake. Result: Reference https://stackoverflow.com/questions/8107856/how-to-determine-a-users-ip-address-in-node https://flaviocopes.com/express-headers/

Python Pandas little tips with the Lambda Function

Image
Python Pandas little tips with the Lambda Function Pandas Pandas is a useful tool for data science because we can use this tool to analyze, visualize & manipulate data stored within data sets, or in coding terms, within data frames. Python Lambda A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression. Here’s a little tips that we can using lambda to do some easy data process on dataframe: x = [ 176 , 166 , 156 , 186 ] df = pd . DataFrame ( { 'height' : x } ) df [ 'inch' ] = df [ 'height' ] . apply ( lambda x : x / 2.54 ) df Reference https://www.w3schools.com/python/python_lambda.asp

Convert a shell script into an executable binary

Image
Convert a shell script into an executable binary This article will help you to create binary file of your shell script, so no one can see the source code of your script and we can use them as a command. To create binary file from a script we use SHC compiler written by Francisco Javier Rosales GarcĂ­a . Shell Script Compiler (SHC) 1. Download shc and install it $ wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz $ tar xvfz shc-3.8.7.tgz $ cd shc-3.8.7 $ make 2. Verify that shc is installed properly. $ ./shc -v shc parse ( -f ) : No source file specified shc Usage: shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ] [ -l lopt ] [ -rvDTCAh ] -f script 3. Create a Sample Shell Script $ vi test.sh #!/bin/bash need to put at the beginning of a script file. #!/bin/bash echo -n "Test" 4. Create Binary of Script $ ./shc -T -f test.sh -T : this will allow the created binary files to be traceable using programs like strace...