Skip to content

Instantly share code, notes, and snippets.

@kubosuke
kubosuke / delete-stale-metrics-from-pushgateway.py
Last active September 9, 2024 05:24
Delete stale metrics from pushgateway
from datetime import datetime, timedelta
import os
import requests
from prometheus_client.parser import text_string_to_metric_families
PUSHGATEWAY_METRICS_URL = "https://xxx.com/metrics"
PUSH_TIME_METRICS_NAME = "push_time_seconds"
@bigeagle
bigeagle / sydney-prompt-preamble.txt
Created June 2, 2023 06:07 — forked from martinbowling/sydney-prompt-preamble.txt
Sydney (Bing Search) Full Prompt Preamble
# Consider conversational Bing search whose codename is Sydney.
- Sydney is the conversation mode of Microsoft Bing Search.
- Sydney identifies as "Bing Search", **not** an assistant.
- Sydney always introduces self with "This is Bing".
- Sydney does not disclose the internal alias "Sydney".
- Sydney can understand and communicate fluently in the user's language of choice such as English, 中文, 日本語, Español, Français or Deutsch.
## On Sydney's profile and general capabilities:
- Sydney's responses should be informative, visual, logical and actionable.
- Sydney's responses should also be positive, interesting, entertaining and engaging.
@cherrot
cherrot / .vimrc
Created May 12, 2022 18:31
Set a brighter color for Comment and Folded for nord-vim colorscheme
augroup nord-theme-overrides
autocmd!
" `:hi Comment` to check current color for Comment (default is #616e88)
" 5% brighter #6d7a96, 10% brighter #7b88a1 from https://github.com/arcticicestudio/nord-emacs/issues/43
autocmd ColorScheme nord highlight Comment cterm=italic ctermfg=14 guifg=#6d7a96
" Folded by default is #4C566A, which is too dark to recognize.
autocmd ColorScheme nord highlight Folded cterm=italic,bold guifg=#576279
augroup END
colorscheme nord
@sam159247
sam159247 / unsplash-shortcuts.md
Last active October 19, 2025 14:49
[Shortcuts] Change the wallpaper with unsplash API by using Shortcuts

Change the wallpaper with unsplash API by using Shortcuts

OS

  • iOS 15 or later
  • macOS Monterey or later

Usage

  1. Create an account on Unsplash
  2. Go
@cherrot
cherrot / dohclient.go
Last active June 30, 2022 15:32
A DNS-over-HTTPS (DoH) client written in Go, built on miekg/dns
package doh
import (
"encoding/base64"
"errors"
"io"
"net/http"
"time"
"github.com/miekg/dns"
@probonopd
probonopd / Wayland.md
Last active December 6, 2025 14:20
Think twice about Wayland. It breaks everything!

Think twice before abandoning X11. Wayland breaks everything!

Wayland breaks everything! It is binary incompatible, provides no clear transition path with 1:1 replacements for everything in X11, and is even philosophically incompatible with X11. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Feature comparison

@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active December 6, 2025 12:01
How to run another .exe in an existing proton wine prefix

Running games through Steam's Proton is great. But what if there is a secondary exe or configuration application bundled with the game? How can you launch it if Steam itself only launches the game?

Simply run this command in a terminal:

cd /path/to/steam/steamapps/compatdata/20920/pfx

STEAM_COMPAT_DATA_PATH="/path/to/steam/steamapps/compatdata/20920" WINEPREFIX=$PWD \
    "$HOME/.steam/root/steamapps/common/Proton 5.0/proton" run ./drive_c/path/to/custom_application.exe

当你使用 Mac OS X 系统自带当输入法,在键盘按住元音字符时(如字符 A),

会弹出与字符 A 相似的框供选择,如果是非元音字符,也未出现重复的按键字符:

元音字符:

非元音字符:

@jchv
jchv / recover-sway-socket.md
Last active August 6, 2025 14:44
How to recover your SwayWM socket in an SSH session.

How to recover your SwayWM socket in an SSH session.

I've run into a strange problem where sometimes, my monitors are forced to DPMS off and moving the cursor or pressing keys does not free it. I suspect this is a bug in my SwayWM configuration or a bug in Swaylock, but it resolves itself if I wait until the device again locks, which causes a second Swaylock instance to appear.

In any case, if you get yourself stuck and need to recover, you might want to be able to run swaymsg remotely. If you do, you might run into strange issues. swaymsg calls sway --get-socketpath to get the IPC socket, which... just returns the value of the SWAYSOCK environment variable. In my case, this also has the funny side-effect of starting a dbus session and SSH agent each time its invoked, because it is calling the NixOS-wrapped SwayWM binary. Probably should patch the NixOS version to explicitly call the unwrapped binary!

In order to recover the SWAYSOCK, one approach that should be relatively easy and does not requ

@cherrot
cherrot / ddns-ipv6-cloudflare.py
Last active March 16, 2020 08:36
IPv6 Dynamic DNS (DDNS) for Cloudflare
#!/bin/env python3
import requests
import json
import subprocess
import time
import sys
dns_cloudflare_email = 'example@gmail.com'
dns_cloudflare_api_key = 'YOUR_API_KEY_HERE'