Skip to content

Instantly share code, notes, and snippets.

@imDaniX
imDaniX / README Антимат.md
Last active November 8, 2025 07:05
Мат фильтр | Регулярка антимат

Регулярное выражение для нахождения русского мата в тексте. Использовать следует только для первичной модерации, ибо обходится нажатием в одну клавишу. Если вам требуется полноценный фильтра мата, советую прибегнуть к программному пути создания такового, найти третье API, или просто остановиться на ручной модерации.

Выражение писалось в первую очередь с оглядкой на регулярки Java - для других языков может потребоваться адаптация.

Основа регулярного выражения

\b(
((у|[нз]а|(хитро|не)?вз?[ыьъ]|с[ьъ]|(и|ра)[зс]ъ?|(о[тб]|п[оа]д)[ьъ]?|(.\B)+?[оаеи-])-?)?(
  [её](б(?!о[рй]|рач)|п[уа](ц|тс))|
  и[пб][ае][тцд][ьъ]
@vardius
vardius / main.go
Created June 19, 2020 07:59
How to rate limit HTTP requests
package main
import (
"expvar"
"fmt"
"net"
"net/http"
"net/http/httptest"
"sync"
"testing"
@pandeybk
pandeybk / virtvnc.yaml
Last active December 20, 2023 21:22
virtvnc
apiVersion: v1
kind: ServiceAccount
metadata:
name: virtvnc
namespace: kubevirt
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: virtvnc
// Import our library
local jobs = import 'lib/jobs.libsonnet';
// Define override functions
local ref(x) = { only+: { refs: [x] } };
local tag(x) = { tags: [x] };
local submodule(x) = { variables+: { GIT_SUBMODULE_STRATEGY: x } };
{
// Building docker-images
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active November 13, 2025 21:29
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@Piotr1215
Piotr1215 / k8s-bookmarks-CKA-CKAD.html
Last active March 16, 2025 22:45
K8s bookmarks for CKA, CKAD and CKS exams
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1626629115" LAST_MODIFIED="1626629462" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@lenalebt
lenalebt / DefaultKeyBinding.dict
Created December 18, 2019 06:59
How to use a typical Linux / Windows Keybindung on MacOS (tested with 10.15.2 Catalina)
/*
PUT THIS FILE IN ~/Library/KeyBindings/DefaultKeyBinding.dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely
match default behavior on Windows systems. This particular mapping assumes
that you have also switched the Control and Command keys already.
This key mapping is more appropriate after switching Ctrl for Command in this menu:
Apple->System Preferences->Keyboard & Mouse->Keyboard->Modifier Keys...->
Change Control Key to Command
Change Command key to Control
@kvaps
kvaps / linstor_autoplace_troubleshooting.md
Last active February 18, 2024 17:15
Troubleshoot auto-placing with LINSTOR
# linstor r c blbla --auto-place 4 --replicas-on-same opennebula-1=true -s thindata
ERROR:
Description:
    Not enough available nodes
Details:
    Not enough nodes fulfilling the following auto-place criteria:
     * has a deployed storage pool named 'thindata'
     * the storage pool 'thindata' has to have at least '104857600' free space
     * the current access context has enough privileges to use the node and the storage pool
#!/bin/bash
function usage()
{
echo "Export Nexus Repositories."
echo ""
echo "./nexus-export"
echo -e "\t--help"
echo -e "\t--localNexusUrl"
@bzon
bzon / go_graceful_shutdown.md
Last active October 5, 2021 18:29
Golang gracefull shutdown with Context

Version 1.

package main

import (
	"context"
	"fmt"
	"os"
	"os/signal"