Skip to content

Instantly share code, notes, and snippets.

@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@Islomov49
Islomov49 / DecimalAmountTransformation.kt
Last active May 7, 2024 05:01
Decimal Amount Visual Transformation - Jetpack compose Visual Transformation for decimal input. Cursor works well! There might be room for optimization
package io.untec.utils.masks
import android.util.Log
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation
import java.math.BigDecimal
@Klerith
Klerith / pasos-node-ts-jest.md
Created August 19, 2023 18:35
Note + TypeScript + Jest = Testing

Pasos para configurar Jest con TypeScript, en Node

Documentación oficial sobre Jest

  1. Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest
@willurd
willurd / web-servers.md
Last active May 7, 2024 04:58
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jake-b
jake-b / usb_hid_gadget.sh
Created May 7, 2020 14:12
Emulate both a keyboard and mouse using the USB
#!/bin/bash
# References:
# https://www.isticktoit.net/?p=1383
# http://irq5.io/2016/12/22/raspberry-pi-zero-as-multiple-usb-gadgets/
# After running this, use hid_gadget_test.c <https://github.com/aagallag/hid_gadget_test/blob/master/hid_gadget_test.c>
cd /sys/kernel/config/usb_gadget/
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active May 7, 2024 04:49
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@smores56
smores56 / weaver-talk.md
Last active May 7, 2024 04:49
Presentation slides for my talk about github.com/smores56/weaver

Weaver

An ergonomic arg parsing library for the Roc programming language.


Table of Contents

  • Introductions
  • Why did I want to make this library?
@MeguminSama
MeguminSama / Discord Experiments.js
Last active May 7, 2024 04:46
Discord Experiments.js
let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUser).exports.default;
var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
var user = UserStore.getCurrentUser();
actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
});
actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
@diego3g
diego3g / settings.json
Last active May 7, 2024 04:43
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
Architecture NVIDIA GPU Instance type Instance name Number of GPUs GPU Memory (per GPU) GPU Interconnect (NVLink / PCIe) Thermal
Design Power (TDP) from nvidia-smi
Tensor Cores (mixed-precision) Precision Support CPU Type Nitro based
Ampere A100 P4 p4d.24xlarge 8 40 GB NVLink gen 3 (600 GB/s) 400W Tensor Cores (Gen 3) FP64, FP32, FP16, INT8, BF16, TF32 Intel Xeon Scalable (Cascade Lake) Yes
Ampere A10G G5 g5.xlarge 1 24 GB NA (