Skip to content

Instantly share code, notes, and snippets.

@alekc
alekc / autotrader-userscript.js
Created May 12, 2023 09:56
Autotrader.co.uk userscript hiding certain cars
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.autotrader.co.uk/car-search*
// @icon https://www.google.com/s2/favicons?sz=64&domain=autotrader.co.uk
// @grant none
// ==/UserScript==
@alekc
alekc / printer.cfg
Last active November 23, 2025 12:49
Ender5 Pro klipper
[include mainsail.cfg]
# This file contains pin mappings for the stock 2020 Creality Ender 5
# Pro with the 32-bit Creality 4.2.2 board. To use this config, during
# "make menuconfig" select the STM32F103 with a "28KiB bootloader" and
# with "Use USB for communication" disabled.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
@alekc
alekc / go-cient.go
Created May 25, 2020 07:45
Watcher snippet for k8
var stopCh <- chan struct{}
watcher := cache.NewListWatchFromClient(k8Client.RESTClient(),"nodes", metaV1.NamespaceAll,fields.Everything())
_, controller := cache.NewInformer(
watcher,
&coreV1.Node{},
time.Second * 10,
cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
node, ok := obj.(*coreV1.Node)
if !ok {
@alekc
alekc / debug-daemon-set.yaml
Last active May 24, 2020 19:36
Debugging daemonset for kubernetes.
# kubectl apply -f https://gist.githubusercontent.com/alekc/bd1c60353171add01301096e67621cd8/raw/debug-daemon-set.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: dnsutil
labels:
k8s-app: fluentd-logging
spec:
selector:
matchLabels:
@alekc
alekc / kill.go
Created May 21, 2020 08:36
Manage the life of a spawned process in go
// Start a process:
cmd := exec.Command("sleep", "5")
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
// Wait for the process to finish or kill it after a timeout (whichever happens first):
done := make(chan error, 1)
go func() {
done <- cmd.Wait()
@alekc
alekc / grafana.yml
Created May 19, 2020 07:22
PMM grafana dashboards configuration
grafana:
plugins:
- digiapulssi-breadcrumb-panel
- grafana-polystat-panel
# - pmm-check-panel-home
# - pmm-update-panel
defaultDashboardsEnabled: true
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
@alekc
alekc / alert.sh
Created May 14, 2020 09:11 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@alekc
alekc / alert.sh
Created May 14, 2020 09:11 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
rm ~/Library/Preferences/com.bjango.istatmenus.plist