#TIL: Double dash "--" option in bash

It signals the end of command options, after which only positional parameters are accepted. Example use: lets say you want to grep a file for the string -v - normally -v will be considered the option to reverse the matching meaning (only show lines that do not match), but with -- you can grep for string -v like this grep -- -v file

April 6, 2020

Using LVM to move Ubuntu to new SSD

Moving old LVM Partition to the new SSD After you have installed the SSD, in my case, it is located at /dev/nvme0n1, and let say your current Ubuntu is installed at /dev/sdOLD # Make it a LVM Physical volume sudo pvcreate /dev/nvme0n1 # Verify it sudo lvmdiskscan # My result: # /dev/nvme0n1 [ 232.89 GiB] LVM physical volume# # /dev/ubuntu-vg/root [ 123.31 GiB] # ..... # /dev/sdOLD [ 123.31 GiB] LVM physical volume# # # Add the new LVM volume to existing ubuntu-vg LVM group sudo vgextend ubuntu-vg /dev/nvme0n1 # Moving the old partion to the new sudo pvmove /dev/sdOLD # Removing the old volume from ubunut-vg group sudo vgreduce ubuntu-vg /dev/sdOLD # Remove the physical logical volume (if you wish) sudo pvremove /dev/sdOLD # Updating grub sudo update-grub sudo grub-install /dev/nvme0n1 Moving your home folder to new SSD # create new logical volume on the remaining space sudo lvcreate -l 100%FREE -n home ubuntu-vg # make file system sudo mkfs -t ext4 /dev/ubuntu-vg/home # mount sudo mount /dev/ubuntu-vg/home /mnt/home # RSync the home folder sudo rsync -aXS --info=progress2 /home/....

April 8, 2018

Download whole Coursera notebook

Context: I am already using coursera-dl to download the videos and it works great, but I missed an analogous tool for the assignments. GREAT NEWS! I have just found a way to download all the assignment files from the coursera-notebook hub. This saved me hours of painful single file downloading: (adapted from here ) Go to the home of the coursera-notebook hub Create a new python notebook Execute !tar cvfz allfiles....

April 1, 2018

Install cuda 9.1 Ubuntu 16.04 notes

Use .deb (network) method https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=debnetwork Download driver at www.nvidia.com/drivers, not not use PPA sudo add-apt-repository ppa:graphics-drivers because it’s not maintained by NVIDIA Ref

March 27, 2018

Neuron network learning

Residual Networks - v2 In the Residual Networks programming excersise, there is one explaination about how ResNet works: We also saw in lecture that having ResNet blocks with the shortcut also makes it very easy for one of the blocks to learn an identity function. This means that you can stack on additional ResNet blocks with little risk of harming training set performance. (There is also some evidence that the ease of learning an identity function–even more than skip connections helping with vanishing gradients–accounts for ResNets’ remarkable performance....

September 18, 2016

FYI: UpNext music player has been removed from Chrome Web Store

P/S: you can still download the extension & install it yourself (version 1.2.14) Github Dropbox Here is the email from Google: {% highlight html %} Dear Developer, Your Google Chrome item, “UpNext Music Player,” with ID: dgkfcdlmdppfhbfmooinbcejdaplobpk did not comply with our policies and was removed from the Google Chrome Web Store. Your item did not comply with the following section of our policy: We don’t allow products or services that facilitate unauthorized access to content on websites, such as circumventing paywalls or login restrictions....

June 25, 2016

EmberJS Links

RFC for reference unification: you’re now able get the relationship’s id without triggering a request. Available since Ember-Data 2.4 https://github.com/emberjs/rfcs/pull/57 ArrayProxy is dead https://vimeo.com/160234990

May 18, 2016

My Front-end Universe

#Architect & Pattern ###“React: Mixins Considered Harmful” https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html https://news.ycombinator.com/item?id=12087796 ###“Container Component” parttern from React https://medium.com/@learnreact/container-components-c0e67432e005#.76q2acit3 ###Presentational and Container Components https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.5o04seadt ###“Smart & Dump” Component http://teropa.info/blog/2016/02/22/dumb-components-and-visual-feedback-in-angular-apps.html #Ember @rwjblue gist, many interesting stuffs https://gist.github.com/rwjblue/8816372 My list of some awesome articles & stuffs: https://gist.github.com/ptgamr/0308ad0d62465f1ea447 #Angular Refactoring to Component http://teropa.info/blog/2015/10/18/refactoring-angular-apps-to-components.html Smart Vs Dump Dilemma: https://www.reddit.com/r/angularjs/comments/48fvh2/smart_vs_dumb_dilemma_thoughts/ #React Best Tutorial for Redux http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html React.js Conf 2015 - Making your app fast with high-performance components https://www.youtube.com/watch?v=KYzlpRvWZ6c Free Redux @egghead https://egghead....

March 2, 2016

One directive, multiple controllers & controllerAs

You can pass multiple controller in to the require property while declaring a directive {% highlight javascript %} app.directive(‘myDirective’, function () { return{ restrict: “A”, require:[’^parentDirective’, ‘^ngModel’], link: function ($scope, $element, $attrs, controllersArr) { // parentDirective controller controllersArr[0].someMethodCall(); // ngModel controller controllersArr[1].$setViewValue(); } } }); {% endhighlight %} Want to use controllerAs syntax for your child directive, but still want to access parent directive’s controller? {% highlight javascript %} app.directive(‘myDirective’, function () { return{ restrict: “A”, require:[’^parentDirective’, ‘myDirective’], controller: ‘myDirectiveController’, controllerAs: ‘childVm’, link: function ($scope, $element, $attrs, ctrls) { var parentCtrl = ctrls[0];...

October 23, 2015

Good stuff: UI-Router cheat sheet

If you didn’t find Ui-Router documentation that useful, it might be a good idea to look at this cheat sheet made by egghead.io. Very neat! https://d2eip9sf3oo6c2.cloudfront.net/pdf/egghead-io-ui-router-cheat-sheet.pdf

September 21, 2015