Skip to content

Instantly share code, notes, and snippets.

View Kutalia's full-sized avatar

Kote Kutalia Kutalia

  • Tbilisi, Georgia
View GitHub Profile
#!/usr/bin/env python3
import hashlib
import binascii
import zlib
import zipfile
import sys
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
@miromannino
miromannino / codeblock.tsx
Created May 24, 2024 11:43
Customizable Code Block Component with shadcn/ui
import React, { useRef } from "react";
import { cn } from "@/lib/utils";
import CodeEditor from "@uiw/react-textarea-code-editor";
export interface CodeBlockProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
language?: string;
darkMode?: boolean;
}
export default class EventEmitter
{
constructor()
{
this.callbacks = {}
this.callbacks.base = {}
}
on(_names, callback)
{
@jordymeow
jordymeow / useImage.js
Last active May 17, 2025 22:26
Simple React Hook which handles the status (loading, loaded or failed) of your images. It does a bit of caching.
const { useState, useEffect, useRef } = require('react');
function useImage({ src }) {
let [ image, setImage ] = useState({ src: null, status: 'loading' });
let imageElement = useRef();
let loadedUrls = useRef(new Set());
useEffect(() => {
const onload = () => {
setImage(img => {
# Unix (Terminal)
open -a "Google Chrome" --args --disable-gpu-vsync --disable-frame-rate-limit
# Windows (Command prompt)
start chrome --args --disable-gpu-vsync --disable-frame-rate-limit
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active August 14, 2026 17:02
Conventional Commits Cheatsheet
@topalex
topalex / mime.html
Last active May 17, 2025 22:52
How to check real mime type of image in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mime type checker</title>
<script type="text/javascript" src="/jquery.min.js"></script>
<script>
$(function () {
var result = $('div#result');
if (window.FileReader && window.Blob) {
@danieliser
danieliser / Set Cookie on Form Submit and Close
Last active February 1, 2023 03:44 — forked from rgadon107/Set Cookie on Form Submit and Close
Custom function to pass in a jQuery script to set a cookie via manual JS during 'on_click' trigger event and on form close.
@pixelbrackets
pixelbrackets / api.php
Last active January 11, 2025 09:07
Simple PHP script to test and use cURL
<?php
/**
* Simple request response script
*
* Point you cURL request to this script to see all incoming data
*/
echo '*API*'. PHP_EOL;
@below9k
below9k / scale_db.js
Created January 18, 2017 15:33
Convert range of decibel to percentage and back again
// I wrote this to convert dB to percentage with a weird scale.
// For instance, a user may set an amplifier's min-max dB limits to -50 - 10.
// The UI they use only increments by 1 and dB does not (properly) scale linearly.
// Having to work around these issues I wrote this based on the script I found here www.redwirez.com/pcalc.jsp
// =-=-=-=-=-=-=-=
// Calcs dB to percent with a non-standard dB range
// it does this by getting a new percentage range using min/max dB
// defaults to the standard range of -80 ~ 0 if no min or max is provided
const calcDb = (perc, minDb, maxDb, minP, maxP) => {