Posts

Showing posts from November 12, 2018

Taking text from a file and formatting it

Image
up vote 0 down vote favorite My code takes numbers from a large text file, then splits it to organise the spacing and to place it into a 2-dimensional array. The code is used to get data for a job scheduler that I'm building. #reading in workload data def getworkload(): work = strings = with open("workload.txt") as f: read_data = f.read() jobs = read_data.split("n") for j in jobs: strings.append(" ".join(j.split())) for i in strings: work.append([float(s) for s in i.split(" ")]) return work print(getworkload()) The text file is over 2000 lines long, and looks like this: 1 0 1835117 330855 640 5886 945 -1 -1 -1 5 2 1 4 9 -1 -1 -1 2 0 2265800 251924 640 3124 945 -1 ...

Redirect port 8888 on zone public to be redirected to same port on zone “external” and IP address...

Image
up vote 0 down vote favorite I've an application which is running locally on 127.0.0.1 and port 8888 in addition to openvpn which is installed and using eth1 interface The active zones on firewall firewall-cmd : public (interface: eth0) external (interface: lo eth1) What i'm trying to do : Allow port 8888/tcp on zone public with the openvpn IP source only (To ensure that only in case when the user gets connected to the VPN first then he should be able to access port 8888) Redirecting the public port 8888 where internally the firewall redirects the targeted public port 8888 on zone public to the local IP address 127.0.0.1 and the local port 8888 on zone external I tried these commands but didn't help: # firewall-cmd --permanent --zone=external --add-interface=eth1 # firewall-cmd --permanent --z...