Skip to content

Instantly share code, notes, and snippets.

1 | pattern:
ggg
ggg
2 | pattern:
ggg
gbb
3 | pattern:
ggg
bbg
4 | pattern:
# -*- coding: utf-8 -*-
# Credits
# copied from weechat-notification-center and urlgrab
# - https://github.com/sindresorhus/weechat-notification-center
# - http://darkk.net.ru/weechat/urlgrab.py
import sys
import os
import datetime
import weechat
@sthaha
sthaha / renew-gpgkey.md
Created October 7, 2020 02:41 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@sthaha
sthaha / remote_crc.md
Created March 5, 2020 15:16 — forked from tmckayus/remote_crc.md
Running 'crc' on a remote server

Overview: running crc on a remote server

This document shows how to deploy an OpenShift instance on a server using CodeReady Containers (crc) that can be accessed remotely from one or more client machines (sometimes called a "headless" instance). This provides a low-cost test and development platform that can be shared by developers. Deploying this way also allows a user to create an instance that uses more cpu and memory resources than may be available on his or her laptop.

While there are benefits to this type of deployment, please note that the primary use case for crc is to deploy a local OpenShift instance on a workstation or laptop and access it directly from the same machine. The headless setup is configured completely outside of crc itself, and supporting a headless setup is beyond the mission of the crc development team. Please do not ask for changes to crc to support this type of deployment, it will only cost the team time as they politely decline :)

The instructions here were tested with F

@sthaha
sthaha / follow-line.ts
Last active September 2, 2019 12:53
Mircro:bit k0426 line follower
function indicate(x: string) {
let icon = IconNames.SmallDiamond
switch (x) {
case "stop":
basic.showIcon(IconNames.SmallSquare)
return
case "delete":
basic.showIcon(IconNames.Asleep)
return
from microbit import *
def dim_display():
for x in range(0, 5):
for y in range(0, 5):
c = display.get_pixel(x, y)
if c > 1:
display.set_pixel(x, y, c - 1)
def set_brightness(b):
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
#env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
#!/usr/bin/env bash
colorfg() {
for i in {0..255}; do
printf "\x1b[38;5;${i}m ▩▩▩ %-5i\x1b[0m" $i
if ! (( ($i + 1 ) % 8 )); then
echo
fi
tasks:
- name: deploy
taskRef:
name: some-task
conditions:
# (x || y ) && (a || b)
- Kind: AnyCondition
spec:
conditions:
- ref: manual-approval
@sthaha
sthaha / kubectl-ctx
Last active May 31, 2019 10:38
Adds a kubectl subcommand ctx to get and set namespace
#!/usr/bin/env bash
set -e -u -o pipefail
_log() {
local level=$1; shift
echo -e "$level: $@"
}
log.err() {
_log "ERROR" "$@" >&2