Skip to content

Instantly share code, notes, and snippets.

View DanCouper's full-sized avatar

Dan Couper DanCouper

  • Strive Gaming
  • Newcastle, UK
  • 10:50 (UTC +01:00)
  • X @DanCouper
View GitHub Profile
const edits = [
[
"node_modules/ts-invariant/package.json",
{
type: "module",
exports: {
".": "./lib/invariant.esm.js",
"./process/index.js": "./process/index.js",
},
},
@sts10
sts10 / rust-command-line-utilities.markdown
Last active May 14, 2025 22:55
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@highgrove
highgrove / xstate-test-utils.ts
Created May 28, 2021 06:22
Simple xstate test from machine definition
import {createMachine, EventObject, StateNodeConfig, StateSchema} from "xstate";
import {createModel as xCreateModel} from "@xstate/test";
export type TestDefinition<TTestContext, TContext, TSchema extends StateSchema<TContext>> = {
test?: (context: TTestContext) => Promise<any> | void;
} & (TSchema['states'] extends Record<string, StateSchema<TContext>> ? {
states?: {
[key in keyof TSchema['states']]?: TestDefinition<TTestContext, TContext, TSchema['states'][key]>
}
} : Record<string, never>);
@wbthomason
wbthomason / help.vim
Last active January 29, 2025 08:43
Neovim: Open help in a floating window
scriptencoding utf-8
" This function originates from https://www.reddit.com/r/neovim/comments/eq1xpt/how_open_help_in_floating_windows/; it isn't mine
function! CreateCenteredFloatingWindow() abort
let width = min([&columns - 4, max([80, &columns - 20])])
let height = min([&lines - 4, max([20, &lines - 10])])
let top = ((&lines - height) / 2) - 1
let left = (&columns - width) / 2
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'}
@ffoodd
ffoodd / index.css
Created June 21, 2019 12:00 — forked from stereokai/index.css
Trigonometry in CSS
//----------------------------------*\
// TRIGONOMETRY FUNCTIONS
//----------------------------------*/
// # Trigonometry in CSS
//
// - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
// - Useful if you don't want to use JS.
// - With CSS Variables.
// - `calc()` can't do power (x ^ y) so I used multiplication instead.
@bitsurgeon
bitsurgeon / nvidia.md
Last active October 12, 2024 11:24
install Nvidia driver on Ubuntu with Secure Boot

Install Nvidia Driver on Ubuntu 18.04.3

Secure Boot

This section applies to machines with Secure Boot, such as ThinkPad.

  1. Before installation, switch to "Discrete Graphics" in BIOS, if both Intel and Nvidia graphics are present.
  2. During installation, make sure to select the "Install third-party software for graphics and Wi-Fi hardware and addition media formats" in "Updates and other software" screen.
  3. Select "Configure Secure Boot", and set password.
  4. Continue Ubuntu installation as normal.
@WebReflection
WebReflection / custom-elements-pattern.md
Last active April 29, 2025 19:25
Handy Custom Elements' Patterns

Handy Custom Elements' Patterns

Ricardo Gomez Angel Photo by Ricardo Gomez Angel on Unsplash

This gist is a collection of common patterns I've personally used here and there with Custom Elements.

These patterns are all basic suggestions that could be improved, enriched, readapted, accordingly with your needs.

@ibarchenkov
ibarchenkov / stream_data_ecto_factory.ex
Created January 31, 2019 21:09
Elixir Ecto testing factories combined with StreamData generators.
defmodule MyApp.Factory do
use ExUnitProperties
alias MyApp.{Repo, User, Comment}
### Generators
def generator(:user) do
gen all name <- string(:alphanumeric, min_length: 2),
email <- generator(:email),
age <- integer(10..130) do
from opensimplex import OpenSimplex
from PIL import Image
import random
from heapq import *
mtns = OpenSimplex(seed = random.getrandbits(32))
hills = OpenSimplex(seed = random.getrandbits(32))
bumps = OpenSimplex(seed = random.getrandbits(32))
def terrain((x,y)):
@johnburnmurdoch
johnburnmurdoch / .block
Last active December 20, 2022 17:31
Watercolour affect using HTML5 canvas
license: mit
height: 620
scrolling: no
border: no