Skip to content

Instantly share code, notes, and snippets.

@TylerB24890
TylerB24890 / block-converter.php
Created April 18, 2024 17:00
HTML to Gutenberg Block Converter
<?php
/**
* Block Converter.
* Convert HTML to Gutenberg Blocks.
*
* @package Tyme\BlockConverter
*/
namespace Tyme;
@mkcode
mkcode / route.ts
Last active April 20, 2024 12:16
How to setup Next App Router + Clerk + TRPC
// TRPC API endpoint
// src/app/api/trpc/[trpc]/route.ts
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { type NextRequest } from "next/server";
import { env } from "~/env";
import { appRouter } from "~/server/api/root";
import { createTRPCContext } from "~/server/api/trpc";
import { getAuth } from "@clerk/nextjs/server";
@myfreeer
myfreeer / cycle-denoise.lua
Last active April 20, 2024 12:16
mpv user-script to cycle between lavfi's denoise filters, tested over mpv 0.25.0-58-g99cef59fc
-- settings
-- key_binding: press the key specified below
-- to cycle between denoise filters below,
-- set it to nil to disable the binding
local key_binding = "n"
-- key_binding_reverse cycle between denoise filters below
-- in reverse order, set it to nil to disable the binding,
-- set it to a single-char string to enable
local key_binding_reverse = nil
@kohya-ss
kohya-ss / gradio_llm.py
Last active April 20, 2024 12:12
gradioでLLMを利用する簡易クライアント
# Apache License 2.0
# 使用法は gist のコメントを見てください
import argparse
from typing import List, Optional, Union, Iterator
from llama_cpp.llama_chat_format import _convert_completion_to_chat, register_chat_completion_handler
import llama_cpp.llama_types as llama_types
from llama_cpp.llama import LogitsProcessorList, LlamaGrammar
from llama_cpp import Llama, llama_chat_format
import gradio as gr
@theonlytruegod
theonlytruegod / Quizlet Match Hack Code (use tampermonkey chrome extension)
Last active April 20, 2024 12:09
MOST LIKELY NOT WORKING, I AM NO LONGER UPDATING THIS!!!
// ==UserScript==
// @name Quizlet Match Hack
// @namespace Gabe B. Talafous
// @version 1.6
// @description The time will freeze at 0.5 and the answers will be the same color
// @author You
// @match https://quizlet.com/*/*
// @grant none
// @license MIT
// ==/UserScript==
@jfeilbach
jfeilbach / ubuntu_22.04_motd.md
Last active April 20, 2024 12:09
Make Ubuntu 22.04 less annoying. Remove ESM Ubuntu Advantage

Ubuntu 22.04 Annoyances

Here are a few collected ways I like to customize Ubuntu 22.04 servers. I used to love Ubuntu, but I hate auto updates and snaps. They also put ads and other usless ads diguised as "news" in MOTD. ESM FUD is spread throughout the OS including simple apt functions. You do not need ESM and thus Ubuntu 22.04 has become super annoying. unattended-upgrade is an automatic installation of security (and other) upgrades without user intervention. Consider the ramifications of disabling this service.

Disable unattended upgrades

The Unattended Upgrades feature is enabled by default and it runs at system boot without the user's permission. The configuration is stored in /etc/apt/apt.conf.d/20auto-upgrades

Disable: sudo dpkg-reconfigure unattended-upgrades then a TUI will come up, select "No"

This will not permantently disable the function. After an update it will be enabled. In the file /etc/apt/apt.conf.d/20auto-upgrades change these values from 1 to 0. Even doing this it will

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

#!/usr/bin/env ruby
# encoding: utf-8
#
# This file, gist, is generated code.
# Please DO NOT EDIT or send patches for it.
#
# Please take a look at the source from
# http://github.com/defunkt/gist
# and submit patches against the individual files
# that build gist.
@rakeshopensource
rakeshopensource / TimeBasedOnetimePassword.java
Created September 22, 2023 10:22
The Time-Based One-Time Password (TOTP) algorithm stands as a prevalent technique for producing single-use codes, pivotal for two-factor authentication and enhancing security protocols. For a practical dive into its workings, I've written custom implementation in java.
package org.rakeshopensource.systemdesign;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.stream.IntStream;
public class TimeBasedOnetimePassword {