Skip to content

Instantly share code, notes, and snippets.

@odinsy
odinsy / record.md
Created February 22, 2024 11:48 — forked from lopesivan/record.md
Record tmux session

If you want to record your fancy tmux session with all windows and splits recorded you can do it in the following way:

  • setup your tmux session (tmux new -s session-name, create windows, splits, start processes in them)
  • detach (prefix+d)
  • run asciinema rec -c "tmux attach -t session-name"
  • when you're finished, just detach the session again
@odinsy
odinsy / Betaflight for ubuntu
Created February 27, 2023 17:19 — forked from wlgrd/Betaflight for ubuntu
How to set up betaflight fc with Ubuntu
1. Create a rule for the DFU
$ (echo '# DFU (Internal bootloader for STM32 MCUs)' echo 'ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/45-stdfu-permissions.rules > /dev/null
2. Monitor connection and find your model (unplug/plug the fc while this cmd is active)
$ udevadm monitor --environment --udev | grep ID_MODEL_ID
3. Update the /etc/udev/rules.d/45-stdfu-permissions.rules file with your model. E.g, my MODEL_ID is 5740, and the .rules file
ends up like this:
@odinsy
odinsy / .gitlab-ci.yml
Created December 22, 2022 08:08 — forked from bamnet/.gitlab-ci.yml
Multiarch Go Builds
image: docker:latest
services:
- docker:dind
stages:
- build
variables:
IMAGE: registry.gitlab.com/bamnet/njtdata
DOCKER_CLI_EXPERIMENTAL: enabled
#!/usr/bin/env python
import json, requests, base64, sys, os, re, socket
slack_url = "https://hooks.slack.com/services/###MYKEYHERE#####"
def main():
consul_stdin = json.load(sys.stdin)
getSVCStatus(consul_stdin)
scrape_configs:
- job_name: monitoring
ec2_sd_configs:
- region: us-east-1
port: 9100
relabel_configs:
- action: replace
regex: ".*"
replacement: /var/log/nginx/access.log
target_label: __path__
@odinsy
odinsy / kubernetes_add_service_account_kubeconfig.sh
Created October 10, 2019 15:35 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@odinsy
odinsy / rules-ipv4.iptables
Created April 24, 2019 19:42 — forked from v2px/rules-ipv4.iptables
replaced obsolete state match with conntrack
###############################################################################
# Copyright 2012 Jakub Jirutka. All rights reserved.
#
# "THE KOFOLA-WARE LICENSE" (Revision 1):
# Jakub Jirutka originally wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a Kofola in return. <jakub@jirutka.cz>
#
###############################################################################
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@odinsy
odinsy / README.md
Created February 22, 2019 13:03 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service

[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
@odinsy
odinsy / curl.md
Created December 24, 2018 12:16 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.