Skip to content

Instantly share code, notes, and snippets.

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@zbeekman
zbeekman / GH-CF-strict-SSL-w-CDN.md
Last active May 14, 2024 16:11
Setting up GH-pages with custom domain, strict (end-to-end) SSL with CloudFlare DNS & CDN

Custom domains, GH-pages, Cloudflare and strict SSL end-to-end encryption

Why I wrote this

Before Github supported SSL encryption for github pages sites, many people were using CloudFlare (CF) as their DNS provider and CDN proxy. CF allowed users to enable SSL encryption from the CDN end points/proxies to the end user. This was great and it allowed visitors to your website to connect with a secure connection between their browser and the cloudflare CDN box that was serving your content. However, with this setup one (significant) link in the chain remained unencrypted and

@jidckii
jidckii / alertmanager.tmpl
Created April 5, 2023 14:08
Alertmanager telegram template
{{ define "__yucca_text_alert_list" }}{{ range . }}
---
🪪 <b>{{ .Labels.alertname }}</b>
{{- if .Annotations.summary }}
📝 {{ .Annotations.summary }}{{ end }}
{{- if .Annotations.description }}
📖 {{ .Annotations.description }}{{ end }}
🏷 Labels:
{{ range .Labels.SortedPairs }} <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
{{ end }}{{ end }}
@cshenton
cshenton / d3d11_triangle.c
Last active May 14, 2024 16:09
D3D11 Triangle in C99
#include <assert.h>
#define COBJMACROS
#include <windows.h>
#include <d3d11_1.h>
#include <d3dcompiler.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define TITLE "D3D11 Triangle C"
@jorgensd
jorgensd / script.py
Created May 14, 2024 16:01
Write VTK HDF mesh from DOLFINx
# Author: Jørgen S. Dokken
# SPDX-License-Identifier: MIT
from pathlib import Path
from mpi4py import MPI
import h5py

Elixir Logo DB (script)

Esse é um script para rodar alguns comandos do postgres + ecto :thumbsup-parrot:

Requisitos

Esse script requer 🎀 gum!

Scripts

Você deve colocar as funções abaixo no seu .zshrc ou em um arquivo separado para usar o db:

function ecto() {
@augbog
augbog / .Frontend Technical Interview Prep.md
Last active May 14, 2024 16:04
Frontend Technical Interview Prep: A study guide of things I constantly re-review when interviewing for frontend.

Frontend Technical Interview Prep

EDIT: Well this has been linked now so just an FYI this is still TBD. Feel free to comment if you have suggestions for improvements. Also here is an unrolled Twitter thread of a lot of the tips I talk about on here.

I've been doing frontend for a while now and one thing that really gripes me is the interview. I think the breadth of knowledge of a "Frontend Engineer" has been so poorly defined that people really just expected you to know everything. Many companies have made this a hybrid role. The Web is massive and there are many MANY things to know. Some of these things are just facts that you learn and others are things you really have to understand.

Every time I interview, I go over the same stuff. I wanted to create a gist of the TL;DR things that would jog my memory and hopefully yours too.

Lots of these things are real things I've been asked that caught me off guard. It's nice to have something you ca

@moelody
moelody / feedbro-locale-zh_CN.json
Last active May 14, 2024 16:04
feedbro中文翻译
{
"meta": {
"manifest_version": 3,
"locale_version": "1.3",
"locale_name": "简体中文",
"locale_type": "zh_CN",
"locale_last_updated": "2020-08-07 18:00:00 UTC",
"locale_author_name": "moelody",
"locale_author_email": "yfsmallmoon@gmail.com",
"locale_source_url": "https://gist.github.com/moelody/3159316ce726fc629fae15278bbce429"
@archanpatkar
archanpatkar / itertools.js
Created July 16, 2017 21:37
Using ES6 Generator prototype model to implement lazy chaining. When you set the prototype of multiple Generator Functions to a common prototype you can chain them. Examples at the bottom. (this code currently only works in Firefox Aurora, but will eventually work in all JS engines).
const module = { exports: {} };
let exports = module.exports;
const GeneratorFunction = function*(){}.constructor;
const iteratorSymbol = (typeof Symbol === "function" && Symbol.iterator) || "@@iterator";
const MISSING = {};
/**
* A generator function is always called as a constructor. If multiple
* generators share the same prototype, and you put generators on that shared
@multimentha
multimentha / Diablo 2 item filter.xml
Last active May 14, 2024 16:02
Notepad++ syntax highlighting for Diablo 2 loot filters
<NotepadPlus>
<UserLang name="D2 item filter" ext="filter" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="yes" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>