15 Feb 2016
|
bash
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.
12 Feb 2016
|
python
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
11 Feb 2016
|
oar
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
11 Feb 2016
|
bash
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
- Command 5: Using curl
src : 5 Commands to Get Public IP using Linux Terminal
11 Feb 2016
|
oar
Deleting a node
First set state to Dead :
sudo oarnodesetting -s Dead -r $i
Then use oarremoveresource :