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 requests, time, random, traceback | |
| import lxml.html as HTML | |
| from lxml.cssselect import CSSSelector | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| from dataclasses import dataclass, field | |
| from operator import attrgetter | |
| from urllib.parse import urlparse | |
| from pathlib import Path | |
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
| #!/opt/local/bin/python | |
| """ | |
| LICENSE: Public domain | |
| """ | |
| import subprocess | |
| import xml.etree.ElementTree as ET | |
| def main(): | |
| try: | |
| ioreg_result = subprocess.run( |
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
| from docutils.core import publish_string | |
| from docutils.nodes import TextElement, Inline, Text, unescape | |
| from docutils.parsers import rst | |
| from docutils.parsers.rst import directives | |
| from docutils.writers.html4css1 import Writer, HTMLTranslator | |
| import re | |
| # ruby node | |
| class ruby(Inline, TextElement): pass | |
| class rt(Inline, TextElement): pass |
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
| from PIL import Image, ImageDraw, ImagePalette | |
| from math import radians, cos, sin | |
| from random import random, randint | |
| def star_points(cx, cy, r=1): | |
| points = [point(d, r) for d in [0,216,72,288,144]] | |
| poly = [points[0], | |
| partway(points[0], points[4], 0.3333), | |
| points[2], | |
| partway(points[2], points[1], 0.3333), |
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
| ;;; comment-box-search-forward.el --- -*- lexical-binding: t; -*- | |
| (require 'rect) | |
| (defun comment-box-search-forward (&optional line-elem bound eval-as-string) | |
| "Search rectangle made by comment symbols. Then evaluate the contents. | |
| Return a a-list like '(beginning end width height content)" | |
| (unless line-elem (if (and (stringp comment-start) | |
| (> (length comment-start) 0)) | |
| (setq line-elem comment-start) |
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 sys | |
| import re, io | |
| import subprocess | |
| import concurrent.futures | |
| from pathlib import Path | |
| from hashlib import md5 | |
| _source_enc = 'euc-jp' | |
| _cdbmake = '/opt/local/bin/cdbmake' |
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
| ;; simple-httpd-utils.el | |
| (require 'simple-httpd) | |
| (defun httpd-start-with-default-dir (&optional should-read) | |
| "Set the value of `httpd-root' to the value of `default-directory'. | |
| Then start the web server with the command (httpd-start). | |
| If a prefix argument SHOULD-READ is non-nil, read from the minibuffer." | |
| (interactive "P") | |
| (let ((docroot (if should-read |
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
| DOCROOT= | |
| DEFAULT_PORT=8000 | |
| SERVER="python -m http.server" | |
| PORT= | |
| if [[ $1 =~ ^[0-9]+$ ]] | |
| then | |
| PORT=$1 | |
| elif [[ -z $1 ]] | |
| then |
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
| ;; org-time-stamp-this-week.el | |
| ;; use `org-agenda-start-on-weekday` | |
| (require 'org-agenda) | |
| (defun org-time-stamp-this-week (&optional from-start-on-weekday) | |
| "Insert a date stamp between a week like a command `org-time-stamp`. | |
| By default, a week start from today to a weekend defined by Org Agenda. | |
| When called with a prefix argument, the start day is the day | |
| `org-agenda-start-on-weekday` on this week." |
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
| /.*[ \t]*struct[ \t]+\([a-zA-Z0-9_]+\)[ \t]*[<:{]/\1/ | |
| /.*[ \t]*enum[ \t]+\([a-zA-Z0-9_]+\)[ \t]*[<:{]/\1/ | |
| /.*[ \t]*class[ \t]+\([a-zA-Z0-9_]+\)[ \t]*[<:{]/\1/ | |
| /.*[ \t]*func[ \t]+\([a-zA-Z0-9_]+\)[ \t]*[<(]/\1/ |
NewerOlder