Skip to content

Instantly share code, notes, and snippets.

@stanruss
stanruss / git установка
Last active April 20, 2024 12:32
Все команды GIT
echo "# название" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/stanruss/название.git
git push -u origin master
git log --oneline - посмотреть все коммиты.
git checkout . - восстановить все.
git checkout "код коммита" - вернуть до состояния этого коммита.
@skyzyx
skyzyx / homebrew-gnubin.md
Last active April 20, 2024 12:30
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@yasirkula
yasirkula / SlicedFilledImage.cs
Last active April 20, 2024 12:29
Combining UI Image's Sliced+Filled features together in Unity
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
using Sprites = UnityEngine.Sprites;
#if UNITY_EDITOR
@goisneto
goisneto / run-as-termux.sh
Created April 21, 2022 15:17
Run Termux on ADB Shell like as on APP
#!/bin/sh
# Add this file on you /sdcard directory on you android Phone
# Enable Debug Mode and ADB, connect you phone on PC, Download ADB Tools
# Run "adb shell" and on adb shell run "sh /sdcard/run-as-termux.sh"
# Enjoy termux, but with restrictions to access some folders like /sdcard
TERMUX_PACKAGE=com.termux
TERMUX_PATH=$ANDROID_DATA/data/$TERMUX_PACKAGE
TERMUX_TMPDIR=$TERMUX_PATH/files/usr/tmp
@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