Skip to content

Instantly share code, notes, and snippets.

@darccio
darccio / Makefile.toolexec
Last active January 17, 2025 09:37
Toolexec example
@PHONY: test
test:
$(eval TMP := $(shell mktemp -d))
go build -o $(TMP)/toolexec-example.run toolexec-example.go
go build -a -toolexec=$(TMP)/toolexec-example.run -o hello main.go
./hello && go clean
rm -rf $(TMP)
@Shpigford
Shpigford / permissions.sql
Created September 8, 2024 18:06
Digital Ocean Postgres Permissions
REVOKE ALL ON DATABASE demo_database FROM demo_user;
GRANT CONNECT ON DATABASE demo_database TO demo_user;
GRANT USAGE, CREATE ON SCHEMA public TO demo_user;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO demo_user;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO demo_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO demo_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE ON SEQUENCES TO demo_user;
#include <stdio.h>
#include <windows.h>
#pragma comment(lib, "winmm.lib")
void Nothing(WORD wKey)
{
}
void PrintKey(WORD wKey)
@laytan
laytan / main.odin
Last active January 17, 2025 09:32
Raylib logging callback to Odin logger
logger: log.Logger
rl_log_buf: []byte
rl_log :: proc "c" (logLevel: rl.TraceLogLevel, text: cstring, args: libc.va_list) {
context = runtime.default_context()
context.logger = logger
level: log.Level
switch logLevel {
case .TRACE, .DEBUG: level = .Debug
case .ALL, .NONE, .INFO: level = .Info
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active January 17, 2025 09:30
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@kashifulhaque
kashifulhaque / NvChad.md
Last active January 17, 2025 09:30
Neovim stuff with NvChad

Neovim keybinds

  • Capital letters do the opposite of small letters in command (Press shift to trigger capital letters)
  • _ (underscore) to move the cursor at the beginning of line (doesn't switch to insert mode)
    • 0 (zero) moves the cursor to the zeroth position of the line (doesn't switch to insert mode)
  • $ (dollar) to move the cursor at the end of line (doesn't switch to insert mode)
  • d$ will delete from wherever your cursor is till the end of the line
  • f<character> to move cursor to the first occurrence of <character>
    • f( to move cursor to first occurence of (
  • t<character> to move cursor to upto but not on the first occurrence of <character>
  • t( to move cursor to first occurence of (
@philschmid
philschmid / get_memory_size.py
Created January 16, 2025 13:53
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
@asheroto
asheroto / README.md
Last active January 17, 2025 09:25
Bypass Windows 11 Upgrade Assistant / PC Health Check / TPM and CPU Settings. Ignore PC Health Check results.

Bypass Windows 11 Upgrade Assistant / PC Health Check / TPM and CPU Settings

To bypass the Windows 11 Upgrade Assistant and avoid the TPM and CPU requirement checks, you can modify specific registry values to trick the system into thinking your computer meets the necessary requirements. This method addresses common error messages, such as:

  • This PC doesn't currently meet Windows 11 system requirements.
  • TPM 2.0 must be supported and enabled on this PC.
  • The processor isn't currently supported for Windows 11.

The Upgrade Assistant checks the following registry key to determine eligibility:

@peterc
peterc / sinatra-react.md
Last active January 17, 2025 09:21
How to set up a basic Sinatra + React webapp

How to set up a basic Sinatra + React webapp in 2025

Let's say you want to use Ruby for the backend of a basic webapp but React on the frontend. Here's how.

(Note: All tested on January 13, 2025 with Ruby 3.3, Sinatra 4.1.1, and React 18.3. Configs may change over time.)

First, create the app folder and set up Sinatra:

mkdir my-sinatra-react-app
@ArtBIT
ArtBIT / thou shall not pusg merge commits.txt
Last active January 17, 2025 09:19
PUSH REJECTED BY EVIL DRAGON BUREAUCRATS
+---------------------------------------------------------------+
| * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * |
+---------------------------------------------------------------+
\
\ ^ /^
\ / \ // \
\ |\___/| / \// .\
\ /V V \__ / // | \ \ *----*
/ / \/_/ // | \ \ \ |
@___@` \/_ // | \ \ \/\ \