Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active March 20, 2025 14:37
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@skottmckay
skottmckay / add_cast_node_for_graph_input.py
Created June 25, 2020 04:23
Add Cast node at start of ONNX graph to be able to provide float32 input to a graph that originally required float16
import onnx
from onnx import helper
from onnx import TensorProto
# create example graph with just an Identity node and float16 input/output
graph_def = helper.make_graph(
nodes = [
helper.make_node(op_type = "Identity", inputs = ['In'], outputs = ['Out'], name = 'first_node'),
],
name = 'test-model',
@t3dotgg
t3dotgg / try-catch.ts
Last active March 20, 2025 14:35
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@TheAlan404
TheAlan404 / LIST.md
Last active March 20, 2025 14:35
Güncel öğrenci eylemleri
@jaeandersson
jaeandersson / qpsolve.py
Last active March 20, 2025 14:35
Solve QP using qpOASES and CasADi from Python
import numpy as NP
import casadi as C
def qpsolve(H,g,lbx,ubx,A=NP.zeros((0,0)),lba=NP.zeros(0),uba=NP.zeros(0)):
# Convert to CasADi types
H = C.DMatrix(H)
g = C.DMatrix(g)
lbx = C.DMatrix(lbx)
ubx = C.DMatrix(ubx)
A = C.DMatrix(A)
A = A.reshape((A.size1(),H.size1())) # Make sure matching dimensions
@nicwolff
nicwolff / XML_breaker.py
Last active March 20, 2025 14:34
Python script to break large XML files
import os
import sys
from xml.sax import parse
from xml.sax.saxutils import XMLGenerator
class CycleFile(object):
def __init__(self, filename):
self.basename, self.ext = os.path.splitext(filename)
self.index = 0
@pietro-lopes
pietro-lopes / read_json_from_mod.js
Last active March 20, 2025 14:30
KubeJS 1.20.1 Script to read any JSON file or folder from mods or vanilla mc
// priority 100
let $ResourcePackLoader
let $PlatformImpl
let $ModNioResourcePack
if (Platform.isForge()){
$ResourcePackLoader = Java.loadClass("net.minecraftforge.resource.ResourcePackLoader")
} else {
$PlatformImpl = Java.loadClass("dev.architectury.platform.fabric.PlatformImpl")
$ModNioResourcePack = Java.loadClass("net.fabricmc.fabric.impl.resource.loader.ModNioResourcePack")
@yajra
yajra / install_oci8_ubuntu20_php7.4.md
Created November 24, 2021 01:04 — forked from eSkiSo/install_oci8_ubuntu20_php7.4.md
Install OCI8 (Oracle) in Ubuntu 20 with PHP 7.4