Skip to content

Instantly share code, notes, and snippets.

View cherrot's full-sized avatar

cherrot cherrot

View GitHub Profile
@kubosuke
kubosuke / delete-stale-metrics-from-pushgateway.py
Last active January 6, 2024 14:26
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 June 29, 2023 19:42
[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 April 18, 2024 08:49
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

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.

Wayland proponents make it seem like Wayland is "the successor" of Xorg, when in fact it is not. It is merely an incompatible alternative, and not even one that has (nor wants to have) feature parity (missing features). And unlike X11 (the X Window System), Wayland protocol designers actively avoid the concept of "windows" (making up incompr

@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active April 16, 2024 18:08
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
@jchv
jchv / recover-sway-socket.md
Last active September 25, 2022 01:50
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'
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active April 18, 2024 22:36
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh