Skip to content

Instantly share code, notes, and snippets.

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

Shaposhnikoff shaposhnikoff

🏠
Working from home
  • Kiev,Ukraine
  • 23:50 (UTC +02:00)
View GitHub Profile
@cyanide-burnout
cyanide-burnout / dhcp-voip.rsc
Last active October 8, 2024 16:39
MikroTik DHCP script for VoIP telephony: get server list from Option 120, update routes, provision server list to PBX
:global list ""
:if ($bound=1) do={
:local alphabet "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F\
\20\21\22\23\24\25\26\27\28\29\2A\2B\2C\2D\2E\2F\30\31\32\33\34\35\36\37\38\39\3A\3B\3C\3D\3E\3F\
\40\41\42\43\44\45\46\47\48\49\4A\4B\4C\4D\4E\4F\50\51\52\53\54\55\56\57\58\59\5A\5B\5C\5D\5E\5F\
\60\61\62\63\64\65\66\67\68\69\6A\6B\6C\6D\6E\6F\70\71\72\73\74\75\76\77\78\79\7A\7B\7C\7D\7E\7F\
\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F\
\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\
\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\
\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF"
sudo qemu-system-aarch64 \
-kernel /Volumes/data/qemu/openwrt-23.05.05-armsr/openwrt-23.05.2-armsr-armv8-generic-initramfs-kernel.bin \
-drive file=/Volumes/data/qemu/openwrt-23.05.05-armsr/openwrt-23.05.2-armsr-armv8-generic-squashfs-rootfs.img.work,if=virtio,format=raw \
-append root=/dev/vda \
-cpu cortex-a57 -m 2048 -smp 2 -machine virt \
-nographic \
-device virtio-net-pci,netdev=net0 -netdev vmnet-host,id=net0,net-uuid=86d5e2de-594c-421e-be0d-8a3ac19dc207 \
-device virtio-net-pci,netdev=net1 -netdev vmnet-bridged,ifname=en0,id=net1
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active November 11, 2024 17:07
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@vi7
vi7 / alertmanager_templates_howto.md
Last active October 1, 2024 15:45
Alertmanager templates testing

Render Alertmanager templates locally

Normally to test Alertmanager templates you need to restart running Alertmanager and wait for alerts to arrive to Slack or email. To speed up this process parts of templates could be rendered locally using predefined alerts data without the need of the actual Alertmanager.

What you still need in this case is amtool which is a part of Alertmanager delivery which could be downloaded here https://github.com/prometheus/alertmanager/releases

Some examples of templates rendering:

# navigate to the templates dir
@alpeb
alpeb / flat-network.sh
Last active May 9, 2024 11:26
2 k3d clusters with 3 nodes each, using the same flat network
#!/usr/bin/env bash
zones=(a b c)
cluster_cidr() {
echo "apiVersion: networking.k8s.io/v1alpha1
kind: ClusterCIDR
metadata:
name: new-cidr
spec:
@sushaanttb
sushaanttb / sample-webhook-template.yaml
Created August 4, 2023 07:44
Template for ArgoCD webhook service, subscription trigger template and trigger condition
service.webhook.mypythonapp:
url: <your_application_base_url>
headers:
- name: Content-Type
value: application/json
subscriptions:
- recipients:
- <your_webhook_name>
triggers:
- on-status-changed
@cGandom
cGandom / RaspberryPi4-qemu.md
Last active November 11, 2024 12:47
Emulating Raspberry Pi 4 with Qemu

Emulating Raspberry Pi 4 with Qemu

Just a quick update before we dive in: what we're actually doing here is running Raspberry Pi OS (64-bit) on a QEMU virtual ARM setup. This isn't full-blown hardware emulation of the Raspberry Pi 4, but more about creating a virtual environment for the OS. It doesn't mimic all the specific hardware features of the Pi 4, but it's pretty useful and great for general testing. I turned to this solution mainly to extract a modified sysroot from the Raspberry Pi OS, something not readily available in other resources. For those looking into detailed emulation of the actual Raspberry Pi 4's hardware in QEMU, check out this link for the latest updates: https://gitlab.com/qemu-project/qemu/-/issues/1208.

Hope it helps! :D

Shortcomings: No GUI yet, only console.

Steps

@birkoff
birkoff / cognito-social-idp-user-pool.md
Last active June 5, 2024 09:33
Documentation for Cognito Setup

Amazon Cognito provides authentication, authorization, and user management for your web and mobile apps. Your users can sign in directly with a user name and password, or through a third party such as Facebook, Amazon, Google or Apple.

https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html

The two main components

You can use identity pools and user pools separately or together.

User pools

User pools are user directories that provide sign-up and sign-in options for your app users

---
apiVersion: v1
kind: Namespace
metadata:
name: default
annotations:
argocd.argoproj.io/sync-wave: "0"
spec: {}
apiVersion: v1
kind: ServiceAccount
@ustayready
ustayready / gpt.py
Created January 16, 2023 23:49
CloudGPT - Use ChatGPT to analyze AWS policies for vulnerabilities
import openai
import boto3
import json
import time
from typing import Dict, List
openai.api_key = '### SET YOUR OPENAPI API KEY HERE ###'
session = boto3.session.Session()
client = session.client('iam')