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
| /.cache/v/cache/lastfailed |
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 python3 | |
| """Closed formula (safe_position3(n)) for Josephus3 problem for 1<=n<2**31""" | |
| from decimal import Decimal, getcontext, localcontext | |
| def safe_position3(n, *, precision=getcontext().prec): | |
| # [jos]: http://user.math.uzh.ch/halbeisen/publications/pdf/jos.pdf | |
| # j(n, k, n - l) = (n - c_m) * k + d_m; | |
| # c_m <= n < c_m_plus_1 | |
| # return j(n, 3, n) + 1; |
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 python3 | |
| """Send telegrams about new videos on subscribed YouTube channels. | |
| To try it, install dependencies: | |
| $ python3 -mpip install aiohttp feedparser werkzeug | |
| run the callback server: | |
| $ env TELEBOT_TOKEN=<token> TELEBOT_CHAT_ID=<chat_id> python3 ytcallback-server.py |
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 python | |
| """Emulate: grep -Ff <letters> [<words>]""" | |
| import curses | |
| import os | |
| import sys | |
| import re | |
| if hasattr(sys.stdout, 'fileno') and os.isatty(sys.stdout.fileno()): | |
| curses.setupterm() |
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/python3 | |
| """Demonstrate that without `sys.exit()` exit status is zero after `app.exit(1)`.""" | |
| import sys | |
| from PyQt5.Qt import QApplication, QPushButton | |
| app = QApplication(sys.argv) | |
| w = QPushButton("Exit 1") | |
| w.clicked.connect(lambda: app.exit(1)) | |
| w.show() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 python3 | |
| """Entry -> queue -> (client request) -> (server response) -> Label""" | |
| import os | |
| import socket | |
| from threading import Thread | |
| from tkinter import BOTH, Tk, ttk | |
| from queue import Queue, Full | |
| def echo_server(host, port): |
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 python3 | |
| """ | |
| - read subprocess output without threads using a socket pair | |
| - show the output in a tkinter GUI (while the process is still running) | |
| - stop subprocess on a button press | |
| """ | |
| import logging | |
| import os | |
| import socket | |
| import sys |
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
| /*.json | |
| /*.xml |