Jump to content

foxp3

Member
  • Posts

    68
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Recent Profile Visitors

693 profile views
  1. I just came up with a similar solution: from random import randint TESTS = 10000 success = 0 for i in range(TESTS): for j in range(5): if randint(1,6) == 6: continue if j == 4: success += 1 else: break print("i, j, success: ",i,j,success) #i used this to check if i,j and success variables count up accordingly. print("Chances at five sixes is", success/TESTS) So it seems like the example code is kind of nonsense?
  2. but what about the break argument?
  3. Hi everybody, I'm new to the python game and therefore I'm studying the book "A coder's apprentice" by Pieter Spronck (free to download @ spronck.net). So far I really enjoy this book but I'm struggling with loops. We have to calculate the possibility to roll 5 dice and get a 6 with each one of them. Math 101 tells me that the probability to get a 6 with one roll is 1/6 - getting 5 sixes is therefore (1/6)^5 which equals to: 0.00013 percent. In the book he wants to show that you can calculate this by simple loops: The code is as follows: from random import randint TESTS = 1000 #number of times to get more valid data success = 0 for i in range(TESTS): for j in range(5): if randint(1,6) != 6: break else: success += 1 print("Chances at five sixes is", success/TESTS) The part I'm struggling with is the inner loop: Let's say we just start the program: i = 0, j = 0 randint delivers 6 > success +1 j = 1 randint delivers 6 > success +1 j = 2 randint delivers 6 > success +1 j = 3 randint delivers 5 > break i = 1, j = 0 .... Let's stop here and say we only have got one chance. My results should now show 3 (success/TESTS). How can the inner loop mimick 5 dice at the same time when all it does is just counting the times I rolled a 6? Or am I completely on the wrong track here? Thanks for your help!
  4. Is there a way to disable iptables and just use UFW? Ive used that one and it seemed supereasy to use.
  5. Sir, you are my absolute hero. It works (I had to leave out the "5" at the first rule though, because it gave me an error). What does conntrack do to make it better? Thanks to all of you for your awesome help!
  6. telnet 127.0.0.1 443 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Without a problem. Could it be that my iptables only have an http entry and not an https entry?
  7. That's why I initially added the "Listen 443" part to my ports.conf file in apache. netstat -plnt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 274/sshd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2770/apache2 That was before I added the "Listen 443" to ports.conf - with it, it looks like this. netstat -plnt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 274/sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2770/apache2 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2770/apache2 iptables -L gives the following: Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW,ESTABLISHED REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination Does this help?
  8. Thank you. I removed the things you mentioned, unfortunately still not working
  9. yeah sorry, paranoid european here. i always try to use fake data. (e.g. foxp3 is not my real name, but i bet you would have guessed that by now )
  10. Hi Team Linus, first off, I'm quite a newbie when it comes to servers. Actually this is my first project. I bought a 100GB v-server and it comes with Ubuntu 16.04 including an apache2 server. It also comes with a fixed IP, lets say 123.123.123.123 and I have a subdomain pointing with an A record directly at the IP. The apache2 default site works perfectly both ways, either typing in cloud.mysuperdomainname.at or the IP directly via HTTP. But I have serious problems installing an SSL certificate (letsencrypt, https://certbot.eff.org/#ubuntuxenial-apache). My ports.conf file: Listen 80 Listen 443 // I added this extra, the original file came without this line <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> My sites-enabled file: 000-default.conf <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName cloud.mysuperdomainname.at DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}access.log combined </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html Servername cloud.mysuperdomainname.at ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet Trying to install the letsencrypt certificate gives the following error: Obtaining a new certificate Performing the following challenges: tls-sni-01 challenge for cloud.mysuperdomainname.at Enabled Apache socache_shmcb module Enabled Apache ssl module Waiting for verification... Cleaning up challenges Failed authorization procedure. cloud.mysuperdomainname.at (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Error getting validation data IMPORTANT NOTES: - The following errors were reported by the server: Domain: cloud.mysuperdomainname.at Type: connection Detail: Error getting validation data To fix these errors, please make sure that your domain name was entered correctly and the DNS A record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided. - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. I tried quite alot and searched google for hours but I don't have any solution yet. Can you guys help me? If you need logfiles or anything, just let me know. That would be awesome.
  11. Im not too happy with raspberry because it only has 100mbit ethernet. My backups take forever. Id rather buy a synology. It will give you a ton of extra features to get started with random home projects.
  12. Ok - I'm sorry for ranting too early. They have a email address - I found it out after logging in to paypal to check the payment status. Still, feels quite shady.
  13. So because of the 50% off - promo that came with the 8k dell monitor video, I enthusiastically bought 2 licences of Synergy, thinking that it might not be this bad. Well unfortunately it is. The Drag-and-drop feature which was one of my biggest incentives to buy that sucker hasn't been working properly for years if you do a quick google search. That's why I thought I'll give it back and request a refund. Now here comes the big deal. There's no contact form or any other e-mail address on Symless' site anywhere at all. It feels like Ive been scammed and Im thinking of pulling back my money via Paypal. Since Symless seems to be located in the UK it is even covered by EU laws. Did anyone ever have a similar experience?
×