Posts

Showing posts from 2019

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...

Problem solve: UniFi USG firmware upgrade failed

Image
Problem solve: UniFi USG firmware upgrade failed Problem I upgraded the wifi equipment and replaced it with the UniFi Series products a few days ago. UniFi Controller can manage all the UniFi devices through the browser, it is very easy to use. However, I got a problem while upgrading the USG to the newer firmware. There are several ways the upgrade the firmware: Via the Controller Web UI Upgrade by pressing “upgrade icon” (on the top right) via controller web UI. After upgrade, my “upgrade icon” is still over there… so Im going to try another way. Via SSH to the device Connect to a device using an SSH, then run the following command: upgrade http://dl.ui.com/unifi/firmware/UGW3/4.4.44.5213844/UGW3.v4.4.44.5213844.tar However, I got the error message: ‘Upgrade image does not support the device.’ Solution Here’s the solution, if you try out all the way that you can do it. Modify the upgrade program in the device: SSH into the USG. Issue ...