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
| /* | |
| Moved to: https://github.com/ArchiveBox/abx-spec-behaviors | |
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 { Page } from "puppeteer"; | |
| import sharp from "sharp"; | |
| // Max texture size of the software GL backand of chronium. (16384px or 4096px) | |
| // https://issues.chromium.org/issues/41347676 | |
| export const MAX_SIZE_PX = 16384; | |
| const takeFullPageScreenshot = async (page: Page) => { | |
| const pageHeight = await getPageHeight(page); | |
| const deviceScaleFactor = page.viewport()?.deviceScaleFactor ?? 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 | |
| # Exhaustive test case demonstrating a patch to Pluggy's PluginManager. | |
| # https://github.com/pytest-dev/pluggy/pull/536 | |
| # Fixes registration of pluggy namespaces that are modules/classes/instances with special attrs: | |
| # - @property | |
| # - @computed_field | |
| # - @classproperty | |
| # - @classmethod | |
| # - @staticmethod | |
| # - Meta classes (e.g. django models) |
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 | |
| from typing import Callable | |
| from pydantic import model_validator, TypeAdapter | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class ModelWithDefaults(BaseSettings): | |
| """ | |
| This is an addon to pydantic_settings's BaseSettings that allows you to use |
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
| - name: Determine available groups | |
| getent: | |
| database: group | |
| - name: Add additional groups to user | |
| user: name="{{user}}" groups="{{item}}" append=yes | |
| when: item in ansible_facts.getent_group | |
| with_items: | |
| - sudo | |
| - wheel |
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 | |
| ### Bash Environment Setup | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | |
| # set -o xtrace | |
| # set -x | |
| # shopt -s nullglob | |
| set -o errexit | |
| set -o errtrace |
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
| # This is an improved Django Paginator that makes Admin list view pages load much faster. | |
| # You can tell if you need this if you see a big slow COUNT() query | |
| # in the django_debug_toolbar SQL panel on every admin list view. | |
| # It improves performance by avoiding running a potentially costly DISTINCT query to | |
| # count total rows on every pageload. Instead, when possible (when there are no filters) | |
| # it does a significantly simpler SELECT COUNT(*) tablename to get the total. | |
| from django.core.paginator import Paginator |
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 | |
| # Installs and configures fancontrol to automatically run Unifi Dream Machine (UDM) fans harder & lower temperatures. | |
| # | |
| # Context: Unifi equipment typically runs *very* hot from the factory unless you customize it. | |
| # I don't want my hard drives to run as hot as they let them get by default (55ºC+), because it shortens lifespan (ideal temp is ~35-45C). | |
| # | |
| # Further Reading: | |
| # - https://linux.die.net/man/8/fancontrol | |
| # - https://community.ui.com/questions/Unifi-Dream-Router-fan-speed/1cb9cf18-e8a0-44b4-8402-ee9bac367bc0 | |
| # - https://www.reddit.com/r/Ubiquiti/comments/13imgqj/udm_pro_fan_speed_is_this_normal/ |
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 re | |
| import os | |
| import sys | |
| import toml | |
| import json | |
| import orjson | |
| import platform | |
| import inspect | |
| import tomllib | |
| import ini2toml |
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 typing import Dict, Any, List | |
| import configparser | |
| import json | |
| import ast | |
| JSONValue = str | bool | int | None | List['JSONValue'] | |
| def load_ini_value(val: str) -> JSONValue: | |
| """Convert lax INI values into strict TOML-compliant (JSON) values""" |