Improve everyday.

color-schemes.md

|

Color schemes for GNOME Terminal and iTerm2

http://mayccoll.github.io/Gogh/

  • Using the given command, you can fetch the themes.
  • To activate the theme, go to Terminal > Change Profile > Default
  • Every new theme is added as Default, so rename them as soon as you downloaded them to be able to choose.

subprocess-multiprocessing.md

|

Using subprocesses with multiprocessing

When using multiprocessing, os.system calls may not be killed on Ctrl+C. Instead, use subprocess.call(<command>).

import multiprocessing as mp
import subprocess
import time

def wait(i):
    subprocess.call('sleep %d' % i, shell=True)
    print(i)
    return i

pool = mp.Pool(processes=4)
x = range(4)
start = time.time()
try:
    pool.map(wait, x, 1)
finally:
    pool.close()
    pool.join()
duration = time.time() - start
print('Done in %.2f s' % duration)

will output

0
1
2
3
Done in 3.0 s

put-nodes-alive.md

|

Setting nodes to alive

All your nodes are suspected because you are still in a prototyping phase

Just simple command for loop :

for i in $(seq 1 6); do sudo oarnodesetting -r $i -s Alive; done

get-public-ip.md

|

Get the public ip from command line

You want to know what is your public ip from the command line.

You can use one of the following command :

  • Command 1. Using wget
    wget http://ipecho.net/plain -O - -q ; echo
    
  • Command 2: Using curl
    curl ipecho.net/plain; echo
    
  • Command 3: Using wget
    wget http://observebox.com/ip -O - -q ; echo
    
  • Command 4: Using curl
    curl icanhazip.com
    
  • Command 5: Using curl
    curl ifconfig.me
    

src : 5 Commands to Get Public IP using Linux Terminal

delete-node.md

|

Deleting a node

First set state to Dead :

sudo oarnodesetting -s Dead -r $i

Then use oarremoveresource :

oarremoveresource $i