This file contains hidden or 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
| for i in {1..5} ; do | |
| (sleep "$i" && echo "worker $i finished") & | |
| (sleep "$i" && echo "worker -$i finished") & | |
| (sleep "$i" && echo "worker --$i finished") & | |
| done |
This file contains hidden or 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 itertools | |
| import time | |
| cycle = itertools.cycle(['-', '/', '|', '\\']) | |
| for i in range(5): | |
| print("Loading", next(cycle), end="\r") | |
| time.sleep(.5) | |
| print("Finished!") | |
| cycle = itertools.cycle(['.', '..', '...', '....']) |
This file contains hidden or 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 difflib | |
| matches = difflib.get_close_matches( | |
| word="ozc", | |
| possibilities=[ | |
| "ozcan", | |
| "ozca", | |
| "zcan", | |
| "stat", | |
| ], |
This file contains hidden or 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 pathlib | |
| import yaml | |
| from yaml.constructor import Constructor | |
| class CustomConstructor(Constructor): | |
| def construct_yaml__secret(self, node): | |
| values = self.construct_mapping(node) | |
| username = values["username"] |
This file contains hidden or 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
| class Element: | |
| tag = None | |
| def __init__(self, *elements, **attrs): | |
| self.elements = elements | |
| self.attrs = attrs | |
| assert self.tag is not None, "Set tag property!" | |
| def html(self): |
This file contains hidden or 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 os | |
| import random | |
| import string | |
| import sys | |
| PY2 = sys.version_info.major == 2 | |
| if PY2: | |
| input = raw_input # noqa | |
| random.choices = random.sample # noqa |
This file contains hidden or 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
| #!/bin/bash | |
| :' | |
| USAGE | |
| ----- | |
| 1) cat test.txt | ./pipe.sh | |
| 2) ./pipe.sh < test.txt | |
| ' | |
| while read line; do |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| success() { | |
| echo -e "\e[1;32m$1\e[0m" | |
| } | |
| info() { | |
| echo -e "\e[1;34m$1\e[0m" | |
| } |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| letters=('A' 'B' 'C') | |
| line1=('oxxo' 'xxxx' 'xxxx') | |
| line2=('xoox' 'xoox' 'xooo') | |
| line3=('xxxx' 'xxxo' 'xooo') | |
| line4=('xoox' 'xoox' 'xooo') | |
| line5=('xoox' 'xxxx' 'xxxx') | |
This file contains hidden or 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 pathlib | |
| import jaydebeapi as jdbc | |
| # Create a dir 'jars' and download related jar files | |
| jars = pathlib.Path(__file__).parent.joinpath("jars") | |
| databases = [ | |
| { | |
| "classname": "org.sqlite.JDBC", |
NewerOlder