Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / README.md
Last active May 31, 2024 12:40
Run Windows 11 IoT ARM on Mac M1 or similar

How to run Windows on Mac

We're going to run Windows 11 IoT (ARM) on Mac M1 (ARM) using the native binary translation, thanks to up-to-date version of qemu which has native hardware support.

Prerequisites

Install qemu and required tools (coreutils - we need truncate/gtruncate, dd/gdd CLI tools, samba - to share files between host and guest VM).

$ brew install qemu coreutils samba
@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 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 / 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 / Vagrantfile
Last active March 31, 2024 17:04
Start Vagrant VM and generate SSH config using triggers
require Vagrant.source_root.join("plugins/commands/ssh_config/command")
Vagrant.configure(2) do |config|
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu"
ubuntu.trigger.after :up do |trigger|
trigger.ruby do |env,machine|
ssh_template = VagrantPlugins::CommandSSHConfig::Command.new(["--host", machine.name.to_s, machine.name.to_s], env)
ssh_config = File.join(File.expand_path('~'), '.ssh', 'config.d', machine.name.to_s)
$stdout = File.new(ssh_config, 'w')
@avoidik
avoidik / README.md
Last active March 31, 2024 15:33
install macports

Install & configure Macports

This method provides an option which doesn't require sudo privileges. This will install all Macports related stuff inside of a ~/macports directory.

Install

mkdir ~/macports
cd ~/macports
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbhxa+PXyl4pelSASVkwfSARCEJ/9TnamXcxg2BNIyWly48MYEMv/3/FRZco0RbRG1ifwxCHoW/7CZQt0cb3aAzrzdcLHKFIYP8HDitk8I6u0l15qptCO6dyZj1NzAjUoXeX+gvnPPEssChM66svXMVBXKD1Dhoqm0miMYeOz907UTmCg0DukUwPUxuCknvU8T9lclLBLmqMVprKGBZFb6zUzmMdCa4APAfJzvP/PuSYIlBU9C5p2W1hJuyLuJzOjSeO6g0ZjbYXJ2xanmS52FdJkqj0denWupww7TYTAsv7QewfdfrXuts0Ve05OqIV+WgqK8DXbRkf2bftam2FB/
@avoidik
avoidik / useradd.sh
Created March 8, 2024 09:36 — forked from igorvoltaic/useradd.sh
Create new user using command line in Mac OS X. Do not forget to set correct permissions for the file.
#!/bin/sh
if [[ `id -u` != 0 ]]; then
echo "Must be root to run script"
exit
fi
read -p "Enter user name and press [ENTER]: " UserName
if [[ $UserName == `dscl . -list /Users UniqueID | awk '{print $1}' | grep -w $UserName` ]]; then
@avoidik
avoidik / README.md
Last active March 28, 2024 11:25
p4merge as git diff tool on macos
# install p4v tools
brew install --cask p4v

# configure git
git config --global diff.tool p4merge
git config --global difftool.p4merge.path /Applications/p4merge.app/Contents/Resources/launchp4merge
git config --global difftool.prompt false
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path /Applications/p4merge.app/Contents/Resources/launchp4merge