Skip to content

Instantly share code, notes, and snippets.

View happz's full-sized avatar

Miloš Prchlík happz

  • Red Hat
  • Brno, Czech Republic
View GitHub Profile
7932 \ exists] /
7933 --------------------------------------------------------
7934 \ ^__^
7935 \ (oo)\_______
7936 (__)\ )\/\
7937 ||----w |
7938 || ||
7939
7940 fatal: [10.0.143.60]: FAILED! => {}
7941
objects = [A, B, C, ...]
for o1 in objects:
for o2 in objects:
if o1 == o2:
continue
f = G * (o1.mass * o2.mass) / distance(o1, o2)
o1.force += f
def colorizeCode(type, value):
color = {
'I': 'Green',
...
}.get(type, 'SomeDefaultColor')
return '<td align=center BGCOLOR="{}">{}</td>'.format(color, value)
# Create dummy directory.
mkdir foo
# Inside that directory, a new file is born.
touch foo/bar
# Reset file's permissions to known values, e.g. ugo=r.
chmod ugo=r foo/bar
ls -al foo
@happz
happz / foo.py
Last active November 14, 2019 13:07
unroll = []
something = []
try:
# Do something...
something.append(1)
# and add a function to `unroll` which, when called, would remove the last item from the list, "undoing" our action
unrolls.append(lambda: something.pop(-1))
Fudgy brownies
==============
## aa
* 115g másla do mísy, nechat povolit
* přidat 1 lžíci oleje
* přidat 255g cukru moučky
* dobře utřít
diff --git a/gluetool/__init__.py b/gluetool/__init__.py
index ee55a52..177ae02 100644
--- a/gluetool/__init__.py
+++ b/gluetool/__init__.py
@@ -1,7 +1,9 @@
from .glue import Glue, Module
from .glue import GlueError, SoftGlueError, GlueRetryError, GlueCommandError, Failure
+from .glue import Result, Ok, Error
from . import utils
def ask_question(question, check, when_wrong):
while True:
# ask the given question, save the response
response = input(question)
# call the given "check" function, if it returns True, the response is valid, return it immediately
if check(response):
return response
# the response was wrong: print the "error message", and start a new iteration
cap_slova = 0
for slovo in slova:
if slovo[0].isupper():
cap_slova += 1
print('There are', cap_slova, 'titlecase words.')
# c) number of uppercase words
upp_slova = 0 #muzu nechat pojmenovani cap_slova protoze dynamicky jazyk
for slovo in slova:
jmeno = None
heslo = None
vyber_textu = None
while True:
if not jmeno:
jmeno = (input('USERNAME: '))
if jmeno not in MEMBERS:
jmeno = None