Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / README.md
Last active May 9, 2024 10:43
Building nfstrace on Amazon Linux 2023

How to compile nfstrace

Prerequisites

Make sure we're using Amazon Linux

$ cat /etc/amazon-linux-release
Amazon Linux release 2023.4.20240429 (Amazon Linux)
@avoidik
avoidik / README.md
Created May 5, 2024 21:29
Jira in Docker on bare AWS EC2 instance

Jira on AWS

Prerequisites

  • VPC with two public subnets
  • A bunch of security groups (WAN to ALB, ALB to EC2, EC2 to RDS, RDS to EC2, EC2 to WAN)
  • ALB and Target Group (Health check on / for 200,302)
  • Route53 Hosted Zone (Public) and A-record to ALB
  • ACM certificate (DNS validation)
  • RDS Instance with Subnet group
@avoidik
avoidik / README.md
Last active May 4, 2024 08:31
Repack APK, make it debuggable
@avoidik
avoidik / curl.sh
Last active April 30, 2024 06:54
Use curl instead of kubectl
#!/bin/bash
#
# download yq
#
curl -fsSL https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64 -o /usr/local/bin/yq
chmod +x /usr/local/bin/yq
#
@avoidik
avoidik / README.md
Last active April 28, 2024 20:39
How to list supported RBAC verbs in Kubernetes?

It appears kubectl has first-class support via api-resources like:

$ kubectl api-resources -o wide
$ kubectl api-resources --api-group certificates.k8s.io -o wide
$ kubectl api-resources --namespaced -o wide

Alternatively, we can use curl to query Kubernetes API, but we have to expose the API endpoint first:

@avoidik
avoidik / README.md
Last active April 14, 2024 16:55
Run mitmproxy on Raspberry Pi

Run mitmproxy on Raspberry Pi as service

Steps

Install prerequisites

sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install --ignore-requires-python mitmproxy==6.0.2
@avoidik
avoidik / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active April 13, 2024 13:58 — forked from 33eyes/commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally
  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  

Or

git config --global filter.strip-notebook-output.clean 'docker run --rm -i -v \"${pwd}:/home/jovyan\" jupyter/datascience-notebook jupyter nbconvert --clear-output --to=notebook --stdin --stdout --log-level=ERROR'
  1. Create a .gitattributes file inside the directory with the notebooks
@avoidik
avoidik / README.md
Last active April 11, 2024 20:38
Build Squid on Raspberry Pi with enabled SSL, SARG, SquidClamAV

Build Squid on Raspberry Pi with enabled SSL, optionally realtime SARG statistics and SquidClamAV

This is the short guide about how to recompile/enable --enable-ssl option in a Squid caching proxy server. The --enable-ssl option turned off by default, to be able to use SslBump feature we have to turn it on. To my own surprise Squid was compiled not only without --enable-ssl flag, but also with GnuTLS due to GPL legal reasons.

Optionally enable:

Squid

@avoidik
avoidik / README.md
Last active April 5, 2024 06:43
Migrate Raspberry Pi from SD to USB

Raspberry Pi from SD to USB

How to switch over from SD-card to USB-attached device (USB thumbstick, USB enclosed SSD or HDD, etc.) to have more durable storage option.

Steps

  1. Connect USB device to your RPI

  2. Make sure USB device visible by the system

@avoidik
avoidik / 006-glibc-conflict.patch
Last active April 3, 2024 19:49
Compile LEDE v17.01.4 for Mikrotik MetaROUTER (MIPS only)
--- a/misc/create_inode.c 2016-09-02 04:17:32.000000000 +0000
+++ b/misc/create_inode.c 2020-01-04 20:56:26.150590109 +0000
@@ -392,7 +392,7 @@
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
off_t start, off_t end, char *buf,
char *zerobuf)