Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
dogukancagatay / export_import_gpg_keys.md
Created July 30, 2024 08:06
Export and import GPG keys

List your secret keys, and decide which one to export.

gpg --list-secret-keys --keyid-format LONG

Export the secret and public parts of the key.

gpg --export --armor  > gpg-pub.asc
@dogukancagatay
dogukancagatay / prepare-commit-msg.sh
Last active July 16, 2024 10:59
Git hook that prepends Jira issue ID from the branch name to the commit message
#!/usr/bin/env bash
#
# Git hook that appends Jira issue ID from the branch name to the commit message.
#
# e.g. for the branch name `feature/ABC-1234/add-xyz`, the `[ABC-1234]`
# is added to the commit message as well as summary.
#
# Installation:
# $ curl -fsSL -o .git/hooks/prepare-commit-msg \
# 'https://gist.githubusercontent.com/dogukancagatay/38792bf7ace99817555389e043ed954a/raw/prepare-commit-msg.sh'
@dogukancagatay
dogukancagatay / extract_rpm.sh
Last active June 20, 2024 11:50
Extract contents of RPM file
#!/usr/bin/env bash
# Reference: https://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm
# cpio flags
# -i = extract
# -d = make directories
# -m = preserve modification time
# -v = verbose
mkdir contents; cd contents
@dogukancagatay
dogukancagatay / rpi4-fedora-boot-fix.md
Created June 8, 2024 21:56
Fix Fedora booting issue on Raspberry Pi 4

When added --args "nomodeset" to arm-image-installer command, booting problem was fixed.

sudo arm-image-installer \
  --image=Fedora-Server-40-1.14.aarch64.raw.xz \
  --target=rpi4 \
  --media=/dev/sda \
  --resizefs \
  --args "nomodeset"
@dogukancagatay
dogukancagatay / first-steps-fedora-40.md
Last active July 31, 2024 09:24
First steps fedora 40

Fedora First Steps

Enable RPMFusion repositories

sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Essential Apps

@dogukancagatay
dogukancagatay / trigger-timedatectl-sync.py
Created March 14, 2024 08:27
Python script to force timedatectl NTP time sync
import socket
import struct
import subprocess
import time
REF_TIME_1970 = 2208988800 # Reference time
def get_ntp_time(addr="0.de.pool.ntp.org") -> int | None:
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@dogukancagatay
dogukancagatay / macos_vm_parallels.md
Created February 8, 2024 14:44
Create MacOS VM on Parallels #macos #parallels #vm

Create MacOS VM on Parallels

Download ipsw image for the desired version of the MacOS. Use the following site to get the link.

wget 'https://updates.cdn-apple.com/2024WinterFCS/fullrestores/042-78241/B45074EB-2891-4C05-BCA4-7463F3AC0982/UniversalMac_14.3_23D56_Restore.ipsw'
@dogukancagatay
dogukancagatay / sdkman-cheatsheet.md
Last active February 6, 2024 09:36
sdkman cheatsheet #sdkman #java

sdkman Cheatsheet

List supported software

sdk list

List Java versions

# sdk list <
@dogukancagatay
dogukancagatay / mypy_compiled.sh
Last active March 15, 2024 13:47
Install compiled version of Mypy #python #mypy
#!/usr/bin/env bash
# Check whether your mypy version compiled: `mypy --version`
# Mypy works a lot faster when using the compiled version
## Usage:
## curl -fL 'https://gist.githubusercontent.com/dogukancagatay/99df8636b0ca9d5a59f40b50f4a70970/raw/mypy_compiled.sh' | bash
MYPY_VERSION="${1:-1.9.0}"
curl -fL -o /tmp/${MYPY_VERSION}.tar.gz "https://github.com/python/mypy/archive/refs/tags/${MYPY_VERSION}.tar.gz"
@dogukancagatay
dogukancagatay / lima_fedora35.yaml
Last active March 30, 2023 15:12
Lima Fedora configuration files derived from default.yaml with fallback image urls
# ===================================================================== #
# BASIC CONFIGURATION (FEDORA 37)
# ===================================================================== #
# Default values in this YAML file are specified by `null` instead of Lima's "builtin default" values,
# so they can be overridden by the $LIMA_HOME/_config/default.yaml mechanism documented at the end of this file.
# VM type: "qemu" or "vz" (on macOS 13 and later).
# The vmType can be specified only on creating the instance.
# The vmType of existing instances cannot be changed.