Bash: Variable – filename example

Variable in bash is not particularly cool until we have a good use of it  😛

> filename="myfile.txt"
> touch $filename
> ls filename
myfile.txt

> rm $filename
> ls $filename
ls: myfile.txt: No such file or directory

> files="file1 file2" 
> touch $files
> ls $files
file1
file2

 

Bash: `type` Command

In unix, type command tells us whether a keyword is taken by the system or not. It is useful when trying to add a new custom command in the terminal and ensure that our command is not in conflict with system ones.

> type test
test is a shell builtin

> type cp
cp is /bin/cp

> type foo
-bash: type: foo: not found

# This is my custom command
> type note  
note is hashed (/Users/.../bin/note)

 

5 Mindsets for Living to the Fullest

This post is a note from a video on 5 Hard Lessons You Need to Learn Before 30. I’m not sure why the magic number 30 is there since everyone’s age span varies a bit differently, but anyways, here are the five lessons:

1. There may not be a tomorrow, so enjoy/do it now.

  • Think about what would be the things that you would regret not do if tomorrow were your last day.
  • Your time is limited and you don’t have forever, so do what you want to and do what you enjoy right now.

2. You’ve got nothing to lose, but everything to gain.

  • Give it your all. You are born to win, so do what winners do

Continue reading

How to loop a video on YouTube

There are two ways:

Method 1: Create a playlist with only your target video and loop that playlist

Screenshot 2018-07-01 at 00.39.27

Method 2: Right click on the video and select loop option. This is a better way since it doesn’t refresh the page none stop 😉

Screenshot 2018-07-01 at 00.41.16

How to Frontside Powerslide

This is a one of skills that helps you slow down stylishly. This post is going to focus on frontside only because it’s easier than backside. And personally, i think frontside looks more stylish and feels safer. So, without further ado, let’s get started.

Pre-requisite: Riding in high speed

Continue reading

WordPress.com – create a custom tag list widget

I never really like Tag Clouds. Just from the UI point of view, making tags big and small is just chaos and ugly. WordPress.com free or personal plan don’t allow you customize the CSS so this is a hacky way to get around it.

Unfortunately, this way doesn’t automatically generate the list and it takes a lot of manual processes to maintain it, but you can do this. Note, it requires you a bit of knowledge in CSS and Javascript. I’ll try my best to walk you through.

Anyways, let’s get started. Here are the 4 steps to get the following result:

Continue reading