Skip to content

Instantly share code, notes, and snippets.

@ganesh-vellanki
ganesh-vellanki / http-cache.interceptor.ts
Created October 19, 2020 13:52
Caching XHR with angular.
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpHeaders,
HttpResponse
} from '@angular/common/http';
import { Observable, of } from 'rxjs';
@t3dotgg
t3dotgg / model-prices.csv
Last active December 17, 2025 23:04
Rough list of popular AI models and the cost to use them (cost is per 1m tokens)
Name Input Output
Gemini 2.0 Flash-Lite $0.075 $0.30
Mistral 3.1 Small $0.10 $0.30
Gemini 2.0 Flash $0.10 $0.40
ChatGPT 4.1-nano $0.10 $0.40
DeepSeek v3 (old) $0.14 $0.28
ChatGPT 4o-mini $0.15 $0.60
Gemini 2.5 Flash $0.15 $0.60
DeepSeek v3 $0.27 $1.10
Grok 3-mini $0.30 $0.50
@Kerryliu
Kerryliu / ugreen_truenas_led.md
Last active December 17, 2025 23:03
TrueNAS UGREEN DXP4800 Plus Status LED Guide

UGREEN DXP4800 Plus TrueNAS Status LED Guide

20240609_035951642_iOS

The following is a quick guide on getting basic status LED functionality working with TrueNAS running on the UGREEN DXP4800 Plus. Theoretically, it should work on all models (with some small revisions to the script), but I only have a DXP4800 Plus. :)

This guide is for cron job that runs a script to update the LEDs every couple minutes, but I'm sure the following can be modified for blinky LEDs as well.

Steps:

@micycle1
micycle1 / a.md
Last active December 17, 2025 23:02
Downloading full-size media from DeviantArt

For direct image URL, the image quality is much lower than the original upload (the resolution and size of the original upload can be found in the right sidebar). This is not the case few years ago when the original image was accessible through right click, but on 2017, Wix acquired DeviantArt, and has been migrating the images to their own image hosting system from the original DeviantArt system. They linked most of the direct images to a stripped-down version of the original images; hence the bad image quality. Below are the three different formats of direct image URLs I found:

  • URL with /v1/fill inside: this means that the image went through Wix's encoding system and is modified to a specific size and quality. In this case, you remove ?token= and its values, add /intermediary in front of /f/ in the URL, and change the image settings right after /v1/fill/ to w_5100,h_5100,bl,q_100. The definitions of the values can be found in [Wix's Image Service](https://support.wi
@samsch
samsch / stop-using-jwts.md
Last active December 17, 2025 22:58
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@wallanpsantos
wallanpsantos / python-cheatsheet-java-devs.md
Created December 17, 2025 22:48
Python para Java Developers - Guia Completo com Exemplos Práticos

Python Cheatsheet para Devs Java

Guia prático e completo para desenvolvedores Java aprendendo Python, com foco em FastAPI, Async/Await e padrões modernos.

🎯 Público-alvo: Devs Java migrando para Python
⏱️ Tempo estimado: 3-6 dias de estudo intensivo
📚 Pré-requisitos: Experiência com Java e OOP


@ddre54
ddre54 / changing_time_zones.sh
Last active December 17, 2025 22:49
Mac OS X - Terminal commands for changing time zones in the machine
# Useful for testing things that are time zone
# sensitive - like scheduling things
# Get current timezone
sudo systemsetup -gettimezone
# Get list of available timezones
sudo systemsetup -listtimezones
# Set the timezone to the selected timezone
@ole
ole / thirty-days-of-metal.md
Last active December 17, 2025 22:49
Warren Moore – Thirty Days of Metal