scripts can be reused for some other commands too. You just need to run this nohup or open a screen for it.
def find_files(directory, pattern):
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename.lower(), pattern):
filename = os.path.join(root, basename)
Its copied from stackoverflow, but it shows a really good example on when to use yield. Basically it returns a generator and thats far more memory efficient than returning a list.
I am keeping this just in case i need to use it again. WOW sooo good.
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -UCopied from http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip
Here is how to install mysql using homebrew
This is a great blog post. I am reposting it:
1. so. The first thing you need to make sure, is that for the content you want to change color on has an ID where you can reference to your program. Something like a android:id=”@+id/name” so you can find it under resources.
2. LinearLayout ly = findViewById(R.id.name)
One of the cool features of UNIX is that you don’t need to have any software installed to send message to users logged on to that machine. There is a handy command called “write” which enables you to do this. Here is the syntax of this command:
$write username tty
Now the question arises, how to know the tty of a particular user. The “who” command of UNIX comes in to play here. Just shoot “who” command on your terminal and see the magic. You will receive the list of all users logged on to that machine with their tty. Below is an example.
$who root :0 May 7 03:51 root pts/1 May 7 03:51 (:0.0) root pts/2 May 7 03:51 (:0.0) user5 pts/10 May 7 04:17 (dhcp-dwf1-4-10-176-162-74) user8 pts/13 May 7 04:12 (dhcp-dwf1-4-10-176-162-180) user9 pts/15 May 7 04:12 (10.176.146.212) user7 pts/14 May 7 04:23 (dhcp-dwf1-4-10-176-162-118) user12 pts/18 May 7 04:14 (dhcp-dwf1-4-10-176-162-119) user11 pts/23 May 7 04:14 (dhcp-dwf1-4-10-176-162-31) user1 pts/22 May 7 04:27 (dhcp-dwf1-4-10-176-162-125) user15 pts/24 May 7 04:14 (dhcp-dwf1-4-10-176-162-65) user6 pts/12 May 7 04:14 (dhcp-dwf1-4-10-176-162-120) user2 pts/28 May 7 04:14 (dhcp-dwf1-4-10-176-162-60) user7 pts/30 May 7 04:14 (dhcp-dwf1-4-10-176-162-118) user4 pts/31 May 7 04:14 (dhcp-dwf1-4-10-176-162-72) user10 pts/32 May 7 04:14 (dhcp-dwf1-4-10-176-162-68) user14 pts/33 May 7 04:14 (dhcp-dwf1-4-10-176-162-27)
If you want to send message to user8, issue following command at your terminal:
$write user8 pts/13
Now write any message you want. To end the message, press Ctrl+D. Your message would be sent.
(copied from) Reference: https://blogs.oracle.com/pranav/entry/how_to_send_message_to_users_l