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
from __future__ import print_function | |
switch = {"case 1": lambda: print("Hey, case 1"), | |
42: lambda: print("The answer to life, the universe, and everything"), | |
"spam": lambda: print("A favourite metasyntactic variable of Pythonistas everywhere"), | |
"fnord": lambda: print("You can't see the fnords."), | |
} | |
val = "spam" | |
switch[val]() |
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
<?doctype html> | |
<html> | |
<body> | |
<meta name="viewport" content="width=100%"> | |
<div id="clock" style="font-size: 18vw;" width="100%"></div> | |
</body> | |
<script> | |
function padTwo(n){ | |
return ("00"+n).slice(-2); |
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 minion function caused an exception: Traceback (most recent call last): | |
File "salt/minion.py", line 797, in _thread_return | |
File "salt/modules/cp.py", line 259, in get_url | |
File "salt/fileclient.py", line 538, in get_url | |
File "salt/utils/__init__.py", line 1069, in fopen | |
IOError: [Errno 13] Permission denied: 'C:/temp' |
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
def tail(filename, n=10): | |
with open(filename, 'r') as f: | |
return ''.join(f.readlines()[-n:]) |
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
#/srv/salt/top.sls | |
base: | |
'myminion': | |
- myminion | |
#/srv/salt/myminion.sls | |
nginx: | |
pkg: | |
- installed |
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
import thing | |
import pytest | |
import hypothesis.strategies as st | |
from hypothesis import given | |
from unittest import mock | |
@pytest.fixture(scope='module') | |
def something(): | |
return 42 |
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
from eve import Eve | |
from eve_sqlalchemy import SQL | |
from sqlalchemy.ext.declarative import declarative_base | |
from eve_sqlalchemy.decorators import registerSchema | |
from eve_sqlalchemy.validation import ValidatorSQL | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.ext.hybrid import hybrid_property | |
from sqlalchemy.orm import column_property, relationship | |
from sqlalchemy import func | |
from sqlalchemy import ( |
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
x | o | x | |
---+---+--- | |
o | x | o | |
---+---+--- | |
o | x | o |
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
Install Postgres Repo: | |
pkg.installed: | |
- name: pgdg-centos94 | |
- sources: | |
- pgdg-centos94: http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-2.noarch.rpm |
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
import sys | |
import curses | |
import time | |
import logging | |
log = logging.getLogger(__name__) | |
log.addHandler(logging.FileHandler('test.log')) | |
log.setLevel(logging.DEBUG) | |
def menu(window, dims): |
OlderNewer