Skip to content

Instantly share code, notes, and snippets.

@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] = {
@mala
mala / aycabta.md
Created January 19, 2025 22:42
aycabtaあるいは糸柳茶蔵のこと

aycabtaあるいは糸柳茶蔵のこと

文章: mala

  • 2025-01-20 初稿
  • 気が向いたら、追記するかもしれない

1

@pk5ls20
pk5ls20 / re-nonebot2.md
Last active January 20, 2025 06:55
[绝赞连载中] re: 从零开始的NoneBot代码解读

re: 从零开始的NoneBot代码解读


(确信)


@robskillington
robskillington / prometheus.proto
Last active January 20, 2025 06:54
Example Python Prometheus remote write client
// Copyright 2016 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@andrewlimaza
andrewlimaza / change-set-expiration-date-programmatically.php
Created January 2, 2025 12:35
Programmatically change the Set Expiration Date from Y1 to Y2 when checkout is in October, November or December.
/**
* Adjust the Set Expiration Date Add On programmatically.
* Automatically adjust Y1-12-31 to be Y2-12-31 if the current month is October or later.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_programmatically_change_set_expiration_date( $raw_date ) {
// No Set Expiration Date, just bail.
if ( empty( $raw_date ) ) {
return $raw_date;
@AllmightySpaceMonkey
AllmightySpaceMonkey / contemplative-llms.txt
Created January 20, 2025 06:47 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@shmup
shmup / torrents.md
Last active January 20, 2025 06:50
transmission blocklist guide

Transmission Blocklist

The Transmission torrent client has an option to set a Blocklist, which helps protect you from getting caught and having the DMCA send a letter/email.

It's as simple as downloading and installing the latest client:

@jcupitt
jcupitt / vikas.c
Created September 2, 2016 14:32
load/shrink/crop/rotate from a mem buffer to stdout with vips C
/* compile with
*
* gcc -Wall vikas.c `pkg-config vips --cflags --libs`
*/
#include <stdio.h>
#include <string.h>
#include <vips/vips.h>
@reterVision
reterVision / udp_client.go
Created July 12, 2014 07:50
A dummy UDP hole punching sample in Go
package main
import (
"encoding/json"
"fmt"
"log"
"net"
"os"
"time"
)

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com