Skip to content

Instantly share code, notes, and snippets.

View Rankarusu's full-sized avatar

Ranka Rankarusu

  • Germany
View GitHub Profile
@Rankarusu
Rankarusu / vimium.vim
Last active August 12, 2026 07:35
Vimium binds
# Trying to mimic lazyvim behavior with vimium
# use H and L for tabs
unmap J
unmap K
map H previousTab
map L nextTab
# use same binds as in vim for page up and down
unmap d
@Rankarusu
Rankarusu / pagination.java
Created August 7, 2026 05:24
Pagination in Quarkus
// use with @Valid @BeanParam in your resource
public record PaginationQuery(
@RestQuery @DefaultValue("1") @Min(1) int page,
@RestQuery @DefaultValue("50") @Max(200) int pageSize) {
}
// wrap your response in this
public record PaginationMeta<T>(
int page,
int pageSize,
int pageCount,
@Rankarusu
Rankarusu / checkPosition.php
Created December 4, 2025 17:21
Check all surrounding fields in a 2d array, ignoring out of bounds elements
private function checkPosition(int $x, int $y, array $grid): bool
{
$neighbors = [];
$offsets = [
[-1, -1],
[-1, 0],
[-1, 1],
[0, -1],
[0, 1],
@Rankarusu
Rankarusu / generateData.sql
Created July 9, 2025 08:56
Generate lots of data in MySQL
drop procedure if exists doWhile;
SET autocommit=0;
SET unique_checks=0;
SET foreign_key_checks=0;
DELIMITER //
CREATE PROCEDURE doWhile()
BEGIN
DECLARE i INT default 1;
WHILE (i <= 15000000) DO
@Rankarusu
Rankarusu / update_timestamps.js
Last active December 22, 2024 17:04
Update file modified date according to name
const { execSync } = require("child_process");
const fs = require("fs");
const pattern = /\D{3}_(\d{8})_.*/;
fs.readdir("./", (err, files) => {
files.forEach((file) => {
const match = pattern.exec(file);
const yyyymmdd = match?.[1];
if (yyyymmdd) {
const output = execSync(`touch -d ${yyyymmdd} -f ${file}`, { encoding: "utf-8" });
@Rankarusu
Rankarusu / axios-utils.ts
Created December 18, 2024 07:58
Axios Logger as interceptor
import { AxiosError, AxiosInstance } from "axios";
// using react-native-logger here
import { Logger } from "@/utils/logger";
export function registerDebugLogger(instance: AxiosInstance) {
Logger.debug("registering debug loggers");
instance.interceptors.request.use(
(config) => {
Logger.debug(
@Rankarusu
Rankarusu / convertFileToBase64.js
Created May 29, 2024 16:16
Simple conversion of files to base64
// MacOS agents in Azure don't come with base64 installed, so we use node to convert our p8 file to base64 so we can use it in the deployment task
const fs = require("fs");
// 0 is node
// 1 is location of this file
const filePath = process.argv[2];
if (!filePath) {
throw new Error("no file path given");
}
@Rankarusu
Rankarusu / brave-flags.conf
Created April 13, 2024 19:18
Brave side scroll gestrues for back and forward on linux
//put this inside ~/.config/brave-flags.conf
--enable-features=TouchpadOverscrollHistoryNavigation
@Rankarusu
Rankarusu / manifest.json
Last active November 25, 2023 16:59
Everforest Thunderbird
{
"manifest_version": 2,
"name": "Everforest",
"version": "1.0.0",
"applications": {
"gecko": {
"id": "some@mail.com",
"strict_min_version": "60.0"
}
},
@Rankarusu
Rankarusu / color.ini
Created November 25, 2023 08:16
Spicetify Everforest Colors
# add to ~/.config/spicetify/Themes/text/color.ini
[Everforest]
accent = a7c080
accent-active = 98BB6C
accent-inactive = 2e383c
banner = a7c080
border-active = a7c080
border-inactive = 7A8478
header = 9DA9A0
highlight = 272e33