Skip to content

Instantly share code, notes, and snippets.

View ismailkarsli's full-sized avatar
🎯
Focusing

İsmail Karslı ismailkarsli

🎯
Focusing
View GitHub Profile
@ismailkarsli
ismailkarsli / otp.html
Created September 8, 2026 14:07
Native OTP input with styles
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>One-time code</title>
<style>
/* demo only */
body {
margin: 0;
min-height: 100vh;
@ismailkarsli
ismailkarsli / no-single-statement-function.grit
Last active September 6, 2026 14:36
Biome plugin: block single statement functions
language js(typescript)
or {
JsFunctionDeclaration(body = $body),
JsFunctionExportDefaultDeclaration(body = $body),
JsFunctionExpression(body = $body),
JsArrowFunctionExpression(body = $body),
JsMethodClassMember(body = $body),
JsMethodObjectMember(body = $body)
} where {
@ismailkarsli
ismailkarsli / diffcount.zsh
Created August 30, 2026 13:03
Net git diff excluding tests, documents, lock files etc.
diffcount () {
local base="${1:-HEAD}"
{
git diff --numstat "$base" -- . 2> /dev/null
git ls-files -o --exclude-standard -- . 2> /dev/null | while IFS= read -r f
do
[[ -f "$f" ]] && printf '%s\t0\t%s\n' "$(wc -l < "$f" | tr -d ' ')" "$f"
done
} | awk -F'\t' '
$1 == "-" { next }
@ismailkarsli
ismailkarsli / claugents.sh
Created August 17, 2026 00:00
Recursively symlink CLAUDE.md -> AGENTS.md and .claude -> .agents
# claugents: recursively symlink CLAUDE.md -> AGENTS.md and .claude -> .agents
claugents() {
ignored=(node_modules target .git dist build vendor .venv __pycache__ .next .cache)
prune=()
for dir in "${ignored[@]}"; do
prune+=(-name "$dir" -o)
done
prune=("${prune[@]:0:${#prune[@]}-1}")
@ismailkarsli
ismailkarsli / cloud-init.yaml
Last active August 28, 2023 12:10
cloud-init.yaml
#cloud-config
users:
- name: ismail
groups: users, admin
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdJr63tCOvAaA42XTABCY1BL6jRNwq7qNF5uoNNsqoY ismail@karsli.net
package_update: true
package_upgrade: true
@ismailkarsli
ismailkarsli / docker-auto-prune.sh
Created June 4, 2023 19:52
Automatically prune docker system when disk limit exceeds
#!/bin/sh
ROOT_FS_USAGE=$(df -H / | grep -vE 'Filesystem' | awk '{ print $5}' | cut -d'%' -f1)
DISK_LIMIT=${DISK_LIMIT:-75}
if [ "$ROOT_FS_USAGE" -ge "$DISK_LIMIT" ]; then
echo "Cleaning up docker images"
docker system prune -af --filter="until=1h"
fi
@ismailkarsli
ismailkarsli / launch.json
Created October 14, 2021 13:25
Vue için Chrome debug
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "attach",
"name": "Chrome debug",
"urlFilter": "http://localhost:8080/*",
"port": 9222,
"webRoot": "${workspaceFolder}/src",
version: "2.1"
services:
sonarr:
image: linuxserver/sonarr
container_name: sonarr
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Istanbul
import React from "react";
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import "@ckeditor/ckeditor5-build-classic/build/translations/tr.js";
import { useMutation } from "@apollo/client";
import { UPLOAD_PHOTO } from "../../gql/photo/mutation";
class UploadAdapter {
constructor(loader, uploadPhoto) {
this.loader = loader;
@ismailkarsli
ismailkarsli / windows-wallpaper.py
Created August 20, 2020 20:27
Simple Python class for get, set and copy wallpaper on Windows
# Wallpaper.get() Get current wallpapers path. For getting as Pillow image object, use True as parameter.
# Wallpaper.set() Set wallpaper. Can be path of image or Pillow object. File type doesn't matter and path can be absolute or relative.
# Wallpaper.copy() - Copy current wallpaper. First parameter is directory and the second is file name. File extension should be JPG. Default directory is current directory and file name is 'wallpaper.jpg'
from os import path, getenv, getcwd
from ctypes import windll
from shutil import copyfile
from PIL import Image
from tempfile import NamedTemporaryFile