Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / docker-help.md
Last active April 18, 2024 21:04
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@26medias
26medias / automl-vision-node.js
Last active April 18, 2024 21:04
Google Automl Vision: Using a trained tfjs model in NodeJS to classify an image (full working example)
const tf = require("@tensorflow/tfjs-node");
const automl = require("@tensorflow/tfjs-automl");
// Tensorflow Inference
var tfInference = {
loadDictionary: function(modelUrl) {
const lastIndexOfSlash = modelUrl.lastIndexOf("/");
const prefixUrl = lastIndexOfSlash >= 0 ? modelUrl.slice(0, lastIndexOfSlash + 1) : "";
const dictUrl = path.normalize(path.dirname(modelUrl)+'/dict.txt');
const text = fs.readFileSync(dictUrl, { encoding: "utf-8" });
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active April 18, 2024 21:00
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@lpnam0201
lpnam0201 / enumerate-dir-with-more-than-100-files.js
Created January 30, 2020 16:44
FileSystemDirectoryReader.readEntries() only returns 100 entries a time, must be called repeatedly to enumerate all entries.
function readEntriesAsync(reader) {
return new Promise((resolve, reject) => {
reader.readEntries(entries => {
resolve(entries);
}, error => reject(error));
})
}
async function enumerateDirectoryWithManyFiles(directoryEntry) {
let reader = directoryEntry.createReader();
@panzi
panzi / portable_endian.h
Last active April 18, 2024 20:59
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@ABCxFF
ABCxFF / wasmfunc.polyfill.js
Created February 25, 2024 03:44
async WebAssembly.Function polyfill
// For Firefox or other browsers that don't provide WebAssembly.Function APIs,
// this polyfill, albeit async, can be used as a substitute.
//
// Using WASM, this polyfill is accepted by WebAssembly.Tables, and can be inserted
// into them without failure
if (!WebAssembly.Function) {
const vu32 = (x) => {
let out = [];
do {
let byte = x & 0x7F;
{#
/**
* @file
* Theme override to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
@JulianGR
JulianGR / Markdown cheatsheet obsidian.md
Last active April 18, 2024 20:54
Custom Markdown cheatsheet for the note-taking app Obsidian

useful shortcuts

  • Ctrl + N: new note
  • Ctrl + E: toggle edit mode
  • Ctrl + enter: toggle checkbox
  • Ctrl + shift + F: search among all files
  • Ctrl + P: command pannel
  • Ctrl + [ or ] : change indentation of a list item
  • Alt + click to make multiple cursos

Internal linking

<Project>
<!--
=======================================================================
Microsoft.Build.Msix.Packaging.MsixBundle.targets
=======================================================================
This targets file can be imported at the bottom of the main app project file (.csproj):
<Import Project="Microsoft.Build.Msix.Packaging.MsixBundle.targets" />
@TabbyisTrans
TabbyisTrans / backup.json
Created April 18, 2024 20:50
Catppuccin-Mocha-Teal-NightTab
{"nightTab":true,"version":"7.3.0","state":{"layout":{"area":{"header":{"width":74,"justify":"center"},"bookmark":{"width":100,"justify":"center"}},"alignment":"center-center","order":"header-bookmark","direction":"horizontal","size":166,"width":100,"padding":32,"gutter":21,"breakpoint":"xl","scrollbar":"none","title":"","favicon":"","overscroll":false},"header":{"item":{"justify":"left"},"greeting":{"show":true,"type":"custom","custom":"Hii! :3","name":"","size":150,"newLine":false},"transitional":{"show":true,"type":"its","size":150,"newLine":false},"clock":{"hour":{"show":true,"display":"number"},"minute":{"show":true,"display":"number"},"second":{"show":false,"display":"number"},"separator":{"show":true,"text":""},"meridiem":{"show":false},"hour24":{"show":false},"size":412,"newLine":true},"date":{"day":{"show":false,"display":"number","weekStart":"sunday","length":"long"},"date":{"show":true,"display":"number","ordinal":true},"month":{"show":true,"display":"word","length":"short","ordinal":true},"year":{