Skip to content

Instantly share code, notes, and snippets.

@SOF3
SOF3 / k8s_quantity.jq
Last active December 27, 2024 05:52
Parse k8s quantities with jq
def parse_quantity:
{n: -3, u: -2, m: -1, k: 1, K: 1, M: 2, G: 3} as $units |
if .[-1:] == "i" then
{base: 1024, str: .[:-1]}
else
{base: 1000, str: .}
end |
.str[-1:] as $unit |
if $units | has($unit) then
pow(.base; $units[$unit]) * (.str[:-1] | tonumber)
@dieu
dieu / Dockerfile
Last active December 27, 2024 05:47
Home Assistant Docker on Mac OS
FROM homeassistant/home-assistant:stable
# Install avahi-daemon in container
# https://gnanesh.me/avahi-docker-non-root.html
RUN set -ex \
&& apk --no-cache --no-progress add avahi avahi-tools dbus \
# Disable default Avahi services
&& rm /etc/avahi/services/* \
&& rm -rf /var/cache/apk/*
Taken from: http://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/
System-wide SSH client configuration files
/etc/ssh/ssh_config : This files set the default configuration for all users of OpenSSH clients on that desktop/laptop and it must be readable by all users on the system.
User-specific SSH client configuration files
~/.ssh/config or $HOME/.ssh/config : This is user’s own configuration file which, overrides the settings in the global client configuration file, /etc/ssh/ssh_config.
~/.ssh/config file rules
@ctrlcctrlv
ctrlcctrlv / rust-maintainer-perfectionism.md
Last active December 27, 2024 05:43
Rust maintainer perfectionism

Rust maintainer perfectionism, or, the tragedy of Alacritty

I did not submit this to Hacker News and did not intend that this post would have high circulation but have no real problem with it being there or with it having such. I have more recent comments below. This post is from January 2020 and predates the Modular Font Editor K (MFEK) project.

I have not worked on Rust projects in quite a while, and don't know if I ever will again. I feel many crate maintainers are way too perfectionist, for example, despite all the developer hours that went into this PR, it took the effort within years to be (halfway) merged.

There's always a reason not to merge, isn't there? It would be better done with a new nightly language feature, or the function signature should have a where clause, or the documentation is not perfect. There's always a new nit to pick in the world of Ru

@liuran001
liuran001 / config.yaml
Last active December 27, 2024 05:38
mihomo (Clash Meta) 懒人配置
# mihomo (Clash Meta) 懒人配置
# 版本 V1.15-241205
# https://gist.github.com/liuran001/5ca84f7def53c70b554d3f765ff86a33
# https://obdo.cc/meta
# 作者: 笨蛋ovo (bdovo.cc)
# Telegram: https://t.me/baka_not_baka
# 关注我的 Telegram 频道谢谢喵 https://t.me/s/BDovo_Channel
# 修改自官方示例规则 https://wiki.metacubex.one/example/#meta
# 转载请保留此注释
# 尽量添加了较为详尽的注释,不理解的地方建议对照 虚空终端 (Clash Meta) Docs 进行理解
@b0gdanw
b0gdanw / Disable-Sequoia-Bloatware.sh
Created November 25, 2024 16:42
Disable Sequoia Bloatware
#!/bin/zsh
# WARNING! The script is meant to show how and what can be disabled. Don’t use it as it is, adapt it to your needs.
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12), macOS Ventura (13), macOS Sonoma (14) and macOS Sequoia (15)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
@nathanshipley
nathanshipley / img2img_FLUX_ReduxDepth_NS_02_2024-12-09.json
Last active December 27, 2024 05:36
img2img_FLUX_ReduxDepth_NS_02_2024-12-09
{
"last_node_id": 457,
"last_link_id": 804,
"nodes": [
{
"id": 4,
"type": "SetNode",
"pos": [
-433,
2
@Tostino
Tostino / inkbot-chunked-summary.txt
Last active December 27, 2024 05:36
Generate a chunked summary prompt example
<#meta#>
- Date: 2023-10-05
- Task: summary
<#system#>
Your main objective is to condense the content of the document into a concise summary, capturing the main points and themes.
<#chat#>
<#user#>
Please read the provided Original section to understand the context and content. Use this understanding to generate a summary of the Original section, incorporating relevant details and maintaining coherence with the Prior Summary.
Notes:
@FFY00
FFY00 / issue
Created July 3, 2018 20:18
/etc/issue
___-------- '
_ / /________'
/XX( / \ )XXXXXXXXXXX\'
/XXX( O O )XXXXXXXXXXXXXXX\'
/XXX( U ) XXXXXXX\'
/XXXXX( ) XXXXXXXXXXX\'
/XXXXX/ ( O )__ XXXXXX \XXXXX\'
|XXXXX/ / XXXXXX \__ \XXXXX|'
|XXXXXX__/ XXXXXX \______-----'
--___ |XXX__/ XXXXXX \__ /'
@ryansechrest
ryansechrest / php-style-guide.md
Last active December 27, 2024 05:27
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts