Skip to content

Instantly share code, notes, and snippets.

View osbre's full-sized avatar
🇺🇦
#StandWithUkraine

Ostap Brehin osbre

🇺🇦
#StandWithUkraine
View GitHub Profile
@osbre
osbre / controller.ex
Last active March 27, 2025 15:43
Phoenix controller template without use of Contexts
defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Controller do
use <%= inspect context.web_module %>, :controller
alias <%= inspect schema.module %>
alias <%= inspect context.base_module %>.Repo
def index(conn, _params) do
<%= schema.plural %> = Repo.all(<%= inspect schema.alias %>)
render(conn, :index, <%= schema.collection %>: <%= schema.plural %>)
end
@osbre
osbre / dropdown.blade.php
Last active March 24, 2025 16:46
Laravel Breeze HTML5 native dropdown component (no JavaScript). Remove any inner <button>'s when using.
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
@php
$alignmentClasses = match ($align) {
'left' => 'ltr:origin-top-left rtl:origin-top-right start-0',
'top' => 'origin-top',
default => 'ltr:origin-top-right rtl:origin-top-left end-0',
};
$width = match ($width) {
language_server.diagnostic_ignore_codes:
- worse.docblock_missing_return_type
products = retry_on_failure(times: 2) do
account.client.products.all
rescue => e
account.refresh_token
raise e
end
private
def retry_on_failure(times: , &block)
@osbre
osbre / k.py
Created January 20, 2025 19:59
import os
import re
import time
import win32clipboard
import hashlib
import keyboard
# Define the keywords to monitor
TARGET_WORDS = ["roblox", "onepiece", "gta", "fortnite"]
echo '{"live-restore": true}' | sudo tee /etc/docker/daemon.json > /dev/null
@osbre
osbre / Procfile
Last active January 12, 2025 23:14
web: php artisan octane:start --server=frankenphp --host=0.0.0.0 --port=80 --admin-port=2019
release: php artisan migrate --force
queue: php artisan queue:work
-- Set Write-Ahead Logging for better concurrency
PRAGMA journal_mode = WAL;
-- Enable incremental vacuuming to reclaim free space after deletions
PRAGMA auto_vacuum = INCREMENTAL;
-- Optimize page size for your workload (default 4 KB is generally sufficient)
PRAGMA page_size = 4096;
-- Set automatic WAL checkpointing after 1000 pages (tune this based on workload)
version: '3.3'
services:
traefik:
image: traefik:latest # Use the latest Traefik image
ports:
- target: 80
published: 80
mode: host
import sys
import time
import numpy as np
import resampy
import soundfile as sf
import tensorflow as tf
import params as yamnet_params
import yamnet as yamnet_model