Wednesday, September 2, 2015

Mac linux bash file cut generates ^M characters can't remove

cut function gave me a ^M character?
No it's brought by microsoft
Unable to remove using sed s///g commands
Direct way to remove is using a correct text editor and then delete

linux bash file: more command truncates everyline

The texts will be wrapped up in an unexpected way by "more " command.

Alternative ways have to be used to check the file content(head will also have this problem.)
nano is better
using a Mac texteditor to open is recommended

linux shell script automatically truncate strings

My issue is , whenever I print out some string, Linux will always break them into pieces in a weird way. Finally I figured out that each string in Linux has a maximum number of characters that can be contained.

  • max filename length: 255 bytes

Also, check whether there is space between two variable expansions. This is not good
printf "non-"$local $guys >> test

Also, when printing a mixture of things, start with a string. e.g.

Reference:
http://stackoverflow.com/questions/6571435/limit-on-file-name-length-in-bash

Monday, August 31, 2015

Moto G: how to block/stop an app's notification

settings -> sound & notification -> app notifications -> find the specific app and block.

Saturday, August 22, 2015

Mac can't detect/recognize USB external hard drive

A summary of online sulotions:
1. click on a blank area on desktop, Finder -> preferences -> General (tab), check the external drive item to show it on desktop
2. search the "disk utility " and see whether your disk is there
3. My own method: restart your Mac. And it worked.

Thursday, August 20, 2015

How to restore deleted repository when using Github desktop

Forum streams too long to read. The simple solution:
1. open the github desktop
2. if you deleted your repository, you should add that folder back
3. you may see that Github desktop actually saved your information
4. click on the branch where you saved all your contents of the folder
5. check your folder on Mac. They should be back.

Comments:
Deleting a folder on Github doesn't mean transferring them into the trash can. It also varies with versions. The correct thing to do is, never try to add to the complexity of this issue. Go back to your Github desktop application and see whether you can retrieve the information. I'd say that I'm so lucky to be able to recover all my scripts. And I learned my lesson: Always back up your important files.

Wednesday, July 22, 2015

How to open Matlab command history window

type
>> commandhistory

A temporary window will show up, click the top right triangle and choose "dock"