Skip to content

Instantly share code, notes, and snippets.

View nij4t's full-sized avatar
🐳
︵ 📦

Nijat Mahmudov nij4t

🐳
︵ 📦
View GitHub Profile
@nij4t
nij4t / default.yaml.diff
Created January 24, 2022 14:17
Lima VM config. Docker Desktop replacement for Mac (Apple Silicon Support Patch)
--- default.yaml 2022-01-24 15:12:57.000000000 +0100
+++ default.aarch64.yaml 2022-01-24 15:13:39.000000000 +0100
@@ -110,6 +110,9 @@
else
echo "Docker already installed"
fi
+ # Add aarch64 support
+ systemctl start containerd
+ nerdctl run --privileged --rm tonistiigi/binfmt --install all
@nij4t
nij4t / default.yaml
Last active January 24, 2022 14:15
Lima VM config. Docker Desktop replacement for Mac (Base)
# ===================================================================== #
# BASIC CONFIGURATION
# ===================================================================== #
# Arch: "default", "x86_64", "aarch64".
# "default" corresponds to the host architecture.
arch: "default"
# An image must support systemd and cloud-init.
# Ubuntu and Fedora are known to work.
@nij4t
nij4t / BUILD.bazel
Created August 29, 2021 19:17
Genrule with external executable binary
# _ ______ ____ __ _______ ____ ___ ____________
# | | / / __ \/ __ \/ //_/ ___// __ \/ | / ____/ ____/
# | | /| / / / / / /_/ / ,< \__ \/ /_/ / /| |/ / / __/
# | |/ |/ / /_/ / _, _/ /| |___/ / ____/ ___ / /___/ /___
# |__/|__/\____/_/ |_/_/ |_/____/_/ /_/ |_\____/_____/
#
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
http_file(
name = "kubectl",
@nij4t
nij4t / macros.bzl
Created August 29, 2021 16:53
Macro that generates multiple targets for container image push
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
def push_multiple_containers(registry, tag, images, visibility = ["//visibility:public"], **kwargs):
[container_push(
name = "push_" + image.get("name"),
image = image.get("image"),
format = "Docker",
registry = registry,
repository = image.get("repository"),
tag = tag
@nij4t
nij4t / fix_wsl2_nat.ps1
Created August 17, 2021 19:58
Fix WSL2 NAT
Restart-Service LxssManager
Restart-Service -Force -Name hns
Restart-NetAdapter -Name "vEthernet (WSL)"
net stop winnat
net start winnat
Restart-Service -Force -Name hns
@nij4t
nij4t / optimize_docker_volume.ps1
Created August 17, 2021 19:57
Reduce size of docker data volume in Docker Desktop for WSL2
Optimize-VHD -Path %LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx -Mode Full
@nij4t
nij4t / bazel_build_ci.sh
Last active September 8, 2021 23:06
Bazel Commands
# `services` is a directory with application services that are packages as docker containers.
# It has source codes as well as BUILD.bazel files that define container images for each service.
# We ask git to give us a list of changed files in services directory which is then piped into
# bazel query comand that will give you all container image targets that should be rebuild.
git diff --name-only services ${PREVIOUS_REVISION} | xargs -I{dep} bazel query 'kind("_app_layer", rdeps(//services, {dep}))'
# building changed packages
bazelisk build `git diff --name-only ${PREVIOUS_REVISION} | xargs -I{dep} -P8 bazelisk query 'rdeps(//..., {dep})' --output package`
# publishing docker container image with current revision
k;double sin()
,cos();main(){float A=
0,B=0,i,j,z[1760];char b[
1760];printf("\x1b[2J");for(;;
){memset(b,32,1760);memset(z,0,7040)
;for(j=0;6.28>j;j+=0.07)for(i=0;6.28
>i;i+=0.02){float c=sin(i),d=cos(j),e=
sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
h*e+f*g+5),l=cos (i),m=cos(B),n=s\
in(B),t=c*h*g-f* e;int x=40+30*D*
@nij4t
nij4t / sentry-email-timeout-patch.diff
Last active March 5, 2021 11:43
A patch for config map generated by a helm chart
--- a.yaml 2020-06-26 14:36:39.678864700 +0400
+++ b.yaml 2020-06-26 14:34:38.222195787 +0400
@@ -321,6 +321,12 @@
# Mail Server #
###############
+ # Set the default socket timeout to a value that prevents connections
+ # to our SMTP server from timing out, due to sendmail's greeting pause
+ # feature.
+ import socket
@nij4t
nij4t / Makefile
Last active August 25, 2020 12:18
Makefile for go-semantic-release
SEMREL_PATH?=~/.local/bin/semantic-release
release: sr-install
$(SEMREL_PATH) release
sr-install:
[ -f ${SEMREL_PATH} ] || ./install-semantic-release.sh ${SEMREL_PATH}