Skip to content

Instantly share code, notes, and snippets.

View muvaf's full-sized avatar

muvaffak muvaf

View GitHub Profile
# 2e. Add new default route as primary, downgrade Cogent to backup
/ip route add dst-address=0.0.0.0/0 gateway=38.104.247.130 distance=1 check-gateway=ping comment="WAN2 primary"
/ip route set [find dst-address=0.0.0.0/0 gateway=38.104.67.124] distance=2 check-gateway=ping comment="WAN1 backup"
# 2f. Verify
/ip route print where dst-address=0.0.0.0/0
/ping 1.1.1.1 count=4
@muvaf
muvaf / setup.md
Last active April 20, 2026 22:21
sdsada

Network Setup

Download WinBox. Connect via MGMT port of router. Open WinBox and it will see it.

Quick Setup assumes WAN is on QSFP, e.g. 100G ports, but we use 25G port. So, we need to change it.

Identify which port the ISP fiber is actually in. On the CCR2216,

@muvaf
muvaf / calculate-linuxbrew.py
Created December 10, 2024 22:46
Script to calculate how much of Homebrew users are on linux from live data
import json
import requests
# Download JSON data from URL
url = "https://formulae.brew.sh/api/analytics/os-version/365d.json"
response = requests.get(url)
data = response.json()
# Helper function to convert count strings to integers
def parse_count(count_str):
@muvaf
muvaf / build.sh
Created November 17, 2024 09:53
How to build standalone binary of scrcpy for macOS that does not need any dependencies like ffmpeg
#!/usr/bin/env bash
set -e
# Configuration
FFMPEG_VERSION="7.1"
SDL_VERSION="2.30.9"
LIBUSB_VERSION="1.0.27"
BUILD_DIR="build-macos-static"
DEPS_DIR="deps-static"
@muvaf
muvaf / multiple-app-logs-single-terminal.md
Last active November 16, 2023 17:05
How to browse log lines from multiple apps in single terminal

Browsing log lines in single terminal

You have a pipeline that builds multiple apps in parallel and the logs of every build drops into the same terminal window or you run multiple apps with a single command and one app has too many log lines that it clutters the terminal window.

Install lnav command. It's website is here.

brew install lnav

Run the command and pipe its output:

@muvaf
muvaf / retool.js
Last active October 13, 2023 16:52
Show file size in human readable format in a Retool table
// Replace "item" with your variable name.
{{ (item / Math.pow(1024, Math.floor(Math.log(item) / Math.log(1024)))).toFixed(2) }} {{ Array.from(['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'])[Math.floor(Math.log(item) / Math.log(1024))] }}
/* It'll show like the following:
* 42.00 Bytes
* 1.09 MB
* 2.89 GB
*/
// Credit to https://stackoverflow.com/a/34210131/5233252

A control plane composite (the internal one) will be created with this. We can add more configs over time.

apiVersion: controlplane.spaces.upbound.io
kind: Instance
metadata:
  name: myctp
spec:
  forProvider:
    initialRestorationFrom:
@muvaf
muvaf / xrd-first.yaml
Created July 18, 2023 08:53
Example YAMLs to reproduce
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: eks.example.org
spec:
group: example.org
names:
kind: EKS
plural: eks
versions:
export COMMENT='olala omama /test-examples="provider-aws/examples/acm/*.yaml,provider-aws/examples/ec2/*.yaml"'
export PROVIDER_NAME=$(echo $COMMENT | sed 's/^.*\/test-examples="//g' | cut -d '/' -f 1)
echo "Provider: ${PROVIDER_NAME}"
# Create an array from the test statement. This expands the * signs as well.
PATHS=$(echo $COMMENT | sed 's/^.*\/test-examples="//g' | cut -d '"' -f 1 | sed 's/,/ /g')
EXAMPLE_LIST=""
for PATH in $PATHS
do
@muvaf
muvaf / claim.yaml
Last active January 12, 2022 14:24
jetlag-is-so-nice
# Represented with nice boxes in the UI.
apiVersion: java.application.acme.org/v1alpha1
kind: SpringBoot
metadata:
name: dope-app
namespace: purple-squad
spec:
location: us-central1