Skip to content

Instantly share code, notes, and snippets.

View realkarmakun's full-sized avatar
🏠
Working from home

rkkm realkarmakun

🏠
Working from home
  • Russia
View GitHub Profile
@realkarmakun
realkarmakun / combination.py
Last active January 11, 2024 11:54 — forked from jonesinator/combination.py
Compute the nth combination in lexicographic order more efficiently, also with code for varying lengths
#! /usr/bin/python
#
# This snippet provides a simple function "combination" that can compute an
# arbitrary k-combination of n elements given an index m into the
# lexicographically ordered set of all k-combinations of n elements.
from math import comb
class RustMeFirearmsBEWLR : BlockEntityWithoutLevelRenderer(null, null) {
override fun renderByItem(pStack: ItemStack, pTransformType: ItemTransforms.TransformType, pPoseStack: PoseStack, pBuffer: MultiBufferSource, pPackedLight: Int, pPackedOverlay: Int) {
val item = pStack.item
if (item is RenderedWithBEWLR) {
val renderer = Minecraft.getInstance().itemRenderer
// Pop off the transformations applied by ItemRenderer before calling this
pPoseStack.popPose()
pPoseStack.pushPose()
# Telegraf Configuration
#
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
#
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
#
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
@realkarmakun
realkarmakun / grafana-alertmanager-telegram-template
Last active January 3, 2023 19:11
Grafana alertmanager Telegram Template. Just some Telegram template I use for my Grafana alerts
{{ define "TelegramAlert" }}
{{ if eq .Status "firing" }}🔥<b>[FIRING {{end}}{{ if eq .Status "resolved" }}✅<b>[RESOLVED {{end}}ALERT]</b>
{{ range .Alerts -}}
🔎 <b>Title:</b> <i>{{ .Annotations.title }}</i>
{{ if .Labels.severity }} 📖 <b>Status:</b> `{{ .Labels.severity }}`{{ end }}
🏷️ <b>Labels:</b>
{{ range .Labels.SortedPairs }} 🔖 <i><b>{{ .Name }}:</b> {{ .Value }}</i>
{{end}}
📚 <b>Description:</b> {{ .Annotations.description }}
{{ if gt (len .GeneratorURL) 0 }}💥 <b>Source:</b> {{ .GeneratorURL }}{{ end }}
{
"name": "LateDawn Pool",
"description": "Cardano stakepool",
"ticker": "TEST",
"homepage": "https://github.com/realkarmakun"
}
@realkarmakun
realkarmakun / angular.conf
Last active November 4, 2020 12:57
nginx virtual host config for angular app
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$host$request_uri;
}
# SSL configuration
server {
@realkarmakun
realkarmakun / startargs.md
Last active May 29, 2020 17:28
Modified Minecraft start arguments

Default

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paperclip.jar nogui

Make sure that Pterodactyl have at least 1gb on top of image

Pterodactyl modifyed

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:I
@realkarmakun
realkarmakun / rules.txt
Last active May 16, 2020 21:02
Minecraft AntiDDos rules for UFW
# Protection from SYN flood
-A ufw-before-input -p tcp --syn -j ufw-before-syn-flood
-A ufw-before-syn-flood -m limit --limit 2/s --limit-burst 2 -j RETURN
-A ufw-before-syn-flood -j DROP
# Uncommon MSS Values
-A ufw-before-input -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
# Drop exseccive RST packages
-A ufw-before-input -p tcp -m tcp --tcp-flags RST RST -m limit --limit 2/second --limit-burst 2 -j ACCEPT
Verifying my Blockstack ID is secured with the address 1PhuJJpxn9oXoU27cT8dkepMPJDXgM339x https://explorer.blockstack.org/address/1PhuJJpxn9oXoU27cT8dkepMPJDXgM339x