This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On /etc/systemd/system/httpserver.service: | |
[Unit] | |
Description = Http server | |
Documentation=man:SimpleHTTPServer(1) | |
After = network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/deepstation/www | |
ExecStart=/usr/bin/python -m SimpleHTTPServer 9188 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-agent bash | |
ssh-add ~/.ssh/id_rsa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1- win > apps and features > optional features > add a feature | |
2- Install OpenSSH Server | |
3- win > services > Start OpenSSH SSH Server | |
4- It will create files on: %ProgramData%\ssh | |
5- Edit: %programdata%\ssh\sshd_config (%programdata% == C:\ProgramData) | |
6- Change default port by uncommenting first configuration line: | |
Port <some port other than 22> | |
7- Find line below, uncomment it and change to not allow password: | |
PasswordAuthentication no | |
8- Comment last two lines with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################################ | |
# The following is an explanation of the one-line command below: | |
# First grep to make sure the search string is present in the log file. | |
# Second do the sed -i (edit log file in place) by removing a range of | |
# lines defined in the double quotes. (Double quotes here are very important | |
# to allow to insert shell variables defined by dollar sign $ inside it.) | |
# The range of lines is from the first line to an L line number as "1,Ld". | |
# The line number L is defined by an algebraic expression N-2 as $(expr N - 2). | |
# (The spaces in-between elements inside the expression are very important.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo swapoff -a && sudo swapon -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh <user>@<machine> "echo \"`cat ~/.ssh/id_rsa.pub`\" >> .ssh/authorized_keys" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1- The problem is to make SLURM (https://slurm.schedmd.com/) work properly | |
2- SLURM is very intricate and difficult to set up (here is SLURM 20.02) | |
3- It may be important to have NVIDIA library path added, e.g.: | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia-410 | |
4- SLURM depends on MUNGE that can be installed using apt as: | |
sudo apt-get update | |
sudo apt-get install libmunge-dev libmunge2 munge | |
sudo apt-get clean | |
5- The same is not true for SLURM itself as its apt package is old | |
6- So it seems important to compile it from source code, wgetting aa: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1- Understand slash notation and subnet mask as: | |
2- IP address / number of 1's in the subnet mask, i.e.: | |
3- An IP of 192.168.42.23 with a subnet mask of 255.255.255.0 | |
4- Will have a slash notation as: 192.168.42.23/24 | |
5- That is there are 24 number ones in 255.255.255.0 or | |
6- 11111111.11111111.11111111.00000000 | |
7- A subnet mask says what parts of the IP address can change (0) | |
8- and cannot change (1), so the above mask (255.255.255.0) is | |
9- saying only the last part of the IP address can vary or: 192.168.42.* | |
10- When using iptables to setup rules to access a host machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The problem is to find all neighbor indices l_neighbors at a distance d from a given pixel position pp in any dimension | |
# It uses itertools.product to do n-dimensional list cross product | |
import itertools | |
pp, d = [2, 2], 2 # Example pp pixel position and d distance | |
li = [ list(range(ppi-d, ppi+d+1)) for ppi in pp ] # list of each 1-dimensional pp neighbors for each dimension | |
l_neighbors = [ pli for pli in itertools.product(*li) if any([ p in [l[0], l[-1]] for p, l in zip(pli, li) ]) ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1- The problem is to copy one specific package (e.g. mypackage) in (Ana)conda | |
2- Environment (e.g. base env) to another conda env (e.g. myenv), it may be | |
3- Built or directly installed (via pip or not) and exist three files called: | |
4- mypackage.cp37-win_amd64.pyd, mypackage.py, mypackage-1.0-py3.7.egg-info | |
5- In the site-packages of the base conda env (here Anaconda 3) in: | |
6- ~/Anaconda3/Lib/site-packages/ | |
7- And we can just copy these files from there to the target conda env as: | |
cp ~/Anaconda3/Lib/site-packages/mypackage* ~/Anaconda3/envs/myenv/Lib/site-packages/ | |
8- This copying does not guarantee that all packages dependencies (requirements) of | |
9- The mypackage being copied is satisfied in the target environment, |