Skip to content

Instantly share code, notes, and snippets.

@stemid
stemid / brew.py
Created July 24, 2012 14:07
Homebrew module for ansible
#!/usr/bin/python -tt
# (c) 2012, Stefan Midjich
# Written by Stefan Midjich <swehack@gmail.com>
#
# This module was written for Ansible.
# It doesn't support all of Homebrew yet.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@cferdinandi
cferdinandi / terminal-cheat-sheet.txt
Last active March 28, 2024 22:18
Terminal Cheat Sheet
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@k-amin07
k-amin07 / VFIO.md
Last active March 28, 2024 22:15
VFIO Guide for GPU Passthrough

Introduction:

This guide is for achieving PCI-Passthrough with Intel 7700k and AMD RX 580. My host OS is Manjaro KDE edition, and guest is Windows 10.

Hardware:

Device Type Device
CPU Intel Core i7-7700K
Motherboard ASUS Prime Z270P
RAM Corsair Vengeance (DDR4 3000 MHz)
GPU (Host) Intel HD Graphics
@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active March 28, 2024 22:14
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on

@alexedwards
alexedwards / Makefile
Last active March 28, 2024 22:14
Boilerplate Makefile for Go projects
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/example
BINARY_NAME := example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@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;