Skip to content

Instantly share code, notes, and snippets.

@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active March 28, 2024 22:13
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@dvdhfnr
dvdhfnr / midas_loss.py
Last active March 28, 2024 22:12
Loss function of MiDaS
import torch
import torch.nn as nn
def compute_scale_and_shift(prediction, target, mask):
# system matrix: A = [[a_00, a_01], [a_10, a_11]]
a_00 = torch.sum(mask * prediction * prediction, (1, 2))
a_01 = torch.sum(mask * prediction, (1, 2))
a_11 = torch.sum(mask, (1, 2))
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 22:12
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@d7samurai
d7samurai / .readme.md
Last active March 28, 2024 22:10
Minimal D3D11 bonus material: extra minimal triangle

Minimal D3D11 bonus material: extra minimal triangle

A quick side exercise to see how little code one can get away with to put that RGB triangle on screen using D3D11 (without bending over backwards with trickery). This is a complete app in < 40 LOC (including the HLSL).

pretty minimal d3d11 triangle

For more.. elaborate.. D3D11 reference code, see the original Minimal D3D11, Minimal D3D11 pt2 and Minimal D3D11 pt3

import { type PublicClient, type WalletClient } from "@wagmi/core";
import { providers } from "ethers";
import { type HttpTransport } from "viem";
import { useEffect, useState } from "react";
import type { JsonRpcProvider, JsonRpcSigner } from "@ethersproject/providers";
import { usePublicClient, useWalletClient } from "wagmi";
export function publicClientToProvider(publicClient: PublicClient) {
const { chain, transport } = publicClient;
@cassidoo
cassidoo / base-css.md
Created May 4, 2022 06:37
Base CSS for a plain HTML document

If you don't want to deal with styling a mostly text-based HTML document, plop these lines in and it'll look good:

html {
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  font-size: 1.3em;
  max-width: 40rem;
  padding: 2rem;
  margin: auto;
 line-height: 1.5rem;
@troyfontaine
troyfontaine / 1-setup.md
Last active March 28, 2024 22:06
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@smkplus
smkplus / URP Material Property Block.md
Last active March 28, 2024 22:06
URP Material Property Block
Shader "PBR Master"
{
    Properties
    {
        _Color("Color", Color) = (0, 0, 0, 0)
    }
    SubShader
    {
 Tags
@MagistrAVSH
MagistrAVSH / URP-VertexLit.shader
Last active March 28, 2024 22:06
UniversalRenderingPipeline VertexLit Shader
Shader "Universal Render Pipeline/Custom/VertexLit"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Gain ("Gain", Float) = 1.5
_Color ("Color", Color) = (1,1,1,1)
_EdgeColor ("Edge Color", Color) = (0,0,0,1)
[Toggle] _RemoveDiag("Remove diagonals", Float) = 0.
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active March 28, 2024 22:05
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0