Skip to content

Instantly share code, notes, and snippets.

View skorotkiewicz's full-sized avatar
💻
Programming

Sebastian Korotkiewicz skorotkiewicz

💻
Programming
View GitHub Profile
const AppAiTest = () => {
const generateAI = async (prompt) => {
const res = await fetch("http://localhost:11434/api/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gemma3:latest",
prompt: prompt,
@skorotkiewicz
skorotkiewicz / prepare-commit-msg
Created August 26, 2025 05:03
Commit git with Ollama
#!/usr/bin/env sh
# Make this file executable: chmod +x .git/hooks/prepare-commit-msg
echo "Running prepare-commit-msg hook"
COMMIT_MSG_FILE="$1"
# Get the staged diff
DIFF=$(git diff --cached)
# Generate a summary with ollama CLI and gemma3 model
@skorotkiewicz
skorotkiewicz / ping.sh
Last active June 3, 2025 06:44
my tint2 executors
ping -c 1 ipv4.google.com | grep -oP 'time=\K[0-9.]+ ms'
@skorotkiewicz
skorotkiewicz / SEP<MAC>.cnf.xml
Created January 23, 2025 02:51
Config for Cisco 7942G SIP
<device>
<deviceProtocol>SIP</deviceProtocol>
<sshUserId>casio</sshUserId>
<sshPassword>casio</sshPassword>
<devicePool>
<dateTimeSetting>
<dateTemplate>D.M.Y</dateTemplate>
<timeZone>Central European Standard/Daylight Time</timeZone>
<olsonTimeZone>Europe/Berlin</olsonTimeZone>
<ntps>
@skorotkiewicz
skorotkiewicz / crypto-min.js
Created December 15, 2024 17:50
Crypto messages for postcards
import crypto from "node:crypto";
/**
* Generates a compact key from a seed password
* @param {string} seed - The seed password used to generate the key
* @param {number} [length=16] - The desired length of the generated key
* @returns {string} A compact key derived from the seed
*/
function generateCompactKey(seed, length = 16) {
// Use SHA-256 to generate a deterministic but unique key
@skorotkiewicz
skorotkiewicz / App.jsx
Last active December 5, 2024 15:42
Audio Management Hook and Exports
import React from 'react';
import { AudioLibrary } from './utils/Audios';
function ExampleComponent() {
const handlePlaySiren = () => {
AudioLibrary.siren.play();
};
const handlePlayAlarm = () => {
AudioLibrary.alarm.play();
@skorotkiewicz
skorotkiewicz / resolve.sh
Created July 27, 2024 04:06
Convert videos for DaVinci Resolve
mkdir transcoded; for i in *.mp4; do ffmpeg -i "$i" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov "transcoded/${i%.*}.mov"; done
@skorotkiewicz
skorotkiewicz / formComponent.js
Last active May 31, 2024 15:28
useFormSubmit React Hook
import React from 'react';
import useFormSubmit from './useFormSubmit';
const FormComponent = () => {
const { formRef, handleSubmit } = useFormSubmit(
'http://localhost:3000', // Bazowy URL API
'submit', // Ścieżka endpointu API
(data) => { console.log('Success:', data); },
(error) => { console.error('Error:', error); }
);
@skorotkiewicz
skorotkiewicz / arch-luks-zfs-efistub-install.sh
Created May 27, 2024 23:52 — forked from Matthewacon/arch-luks-zfs-efistub-install.sh
Arch install with ZFS root on LUKS and EFISTUB
# Create your partition layout (using GPT)
# 1 - ESP (FAT32, 128M)
# 2 - Linux (luks, any size)
# Format your partitions
mkfs.fat -F32 /dev/sdx1
cryptsetup luksFormat --key-size 512 --cipher aes-xts-plain64 /dev/sdx2
# Open your luks partition
cryptsetup open /dev/sdx2 luks_root