Skip to content

Instantly share code, notes, and snippets.

View beltiras's full-sized avatar

Árni St. Steinunnarson beltiras

  • Leiguskjól
  • Reykjavík, Iceland
View GitHub Profile
[root@CentOS-71-64-minimal ~]# iptables-save
# Generated by iptables-save v1.4.21 on Thu Sep 24 14:31:51 2015
*filter
:INPUT ACCEPT [4576:497904]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4378:499230]
-A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
from random import random
from collections import Counter
def randbits(n, p):
i = 0
while i<n:
yield random() < p
i += 1
def mc_hothand(trials, p):
def test_it(iter):
s = 0
for i in xrange(0,iter):
p = sum([randint(0,10000000) for i in xrange(0,iter)])
s += p
print s
### methodology:
"""
beltiras@BigWizard:~$ source pypyenv/bin/activate
(pypyenv)beltiras@BigWizard:~$ ipython
import datetime
def percentage_of_first_trump_term_remaining():
return (datetime.datetime.now() - datetime.datetime(year=2017, month=1, day=20))/(datetime.datetime(year=2021, month=1, day=20) - datetime.datetime(year=2017, month=1, day=20))
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCV+A4IbJdxJmM9kLPo/RD+5OsU3W+Uapmbb1cZt2EqQY1jWlaCx/dwmHv68lg8IZkr5bUvz0ivPviY5xCvKUI6C44acUkr5rxUlRxIJ/Ig4YO6RCxZwSiW1ohMR7hf1KYqoH6xhbSn8fDhx88R6u0eLquWrGDGGHOX0lJW6AHyu12HVfdEuxLJ+9H3K/1MHQt1bq/UunxfpFDogowvJc6w7qoDy5Vum4qpADrCFpIn1SWqkOYuwBcq8MceNDxjhVyZezJHf9bWGgc8/S7fWtjpybrJw5f8CWlx3zdki5X42YP8tS73KdSEU0K5zLKhD5+HhdzYDuTpJQOKXxGci7a7 [email protected]
from random import shuffle, choice, randint
key = {}
key['a'] = 11.68
key['b'] = 4.43
key['c'] = 5.24
key['d'] = 3.17
key['e'] = 2.80
key['f'] = 4.03
#!/bin/bash
if [ "$#" -eq 0 ]
then
ls | sort | run-parts ${BASH_SOURCE[0]}
fi
if [ $1 ! 1 ]
then
start = int(input("Input a position between 1 and 10:"))
position = start
if start > 10 or start < 1:
exit()
print("l - for moving left")
print("r - for moving right")
print("Any other letter for quitting")
while True:
move = input("Input your choice:")
if move not in "lr":
from fractions import Fraction
def integer(first):
try:
i = int(first)
except:
return False
return True
@beltiras
beltiras / ppp.py
Last active September 24, 2018 14:44 — forked from gunnarig/ppp.py
from fractions import Fraction
# shares price
def sharesXprice(stock,valiue):
result = stock*valiue
divide = valiue % 1
dollar = int(valiue)
print("{0} shares with market price {1} {2} have valiue ${3}".format(shares,dollar,divide,result))