Skip to content

Instantly share code, notes, and snippets.

View nberlette's full-sized avatar
🧱
make, break, patch, repeat ad infinitum

Nicholas Berlette nberlette

🧱
make, break, patch, repeat ad infinitum
View GitHub Profile
@nberlette
nberlette / playground.rs
Created March 15, 2025 05:37 — forked from rust-play/playground.rs
Code shared from the Rust Playground
//! # `braces`
//!
//! This module implements Bash-like brace expansion. It supports
//! comma-separated options (e.g. `"a{b,c}d"` expands to `["abd", "acd"]`),
//! numeric sequences (e.g. `"file{1..3}.txt"`), alpha sequences, and even
//! nested brace expressions. It also supports stepped sequences (e.g. to
//! generate 10, 20, 30, etc. use `"file{10..30..10}.txt"`).
//!
//! The overall algorithm is similar to the TypeScript version: first the
//! string is “escaped” by swapping literal chars for tokens, balanced brace
@nberlette
nberlette / RenewExpiredGPGkey.md
Created September 29, 2023 18:23 — forked from TheSherlockHomie/RenewExpiredGPGkey.md
Updating expired GPG keys and backing them up 🔑🔐💻

Updating expired GPG keys and their backup 🔑🔐💻

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object
@nberlette
nberlette / deno_install.sh
Created June 5, 2023 04:30 — forked from LukeChannings/deno_install.sh
Deno installation script
#!/bin/sh
# A modification of the standard Deno installation script (https://deno.land/install.sh)
# updated to support downloading a Linux arm64 binary from LukeChannings/deno-arm64
set -e
if ! command -v unzip >/dev/null; then
echo "Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required)." 1>&2
exit 1
fi
@nberlette
nberlette / schema.graphql
Created July 7, 2022 22:26 — forked from nyancodeid/schema.graphql
DenoQL: GraphQL Schema
type Query {
page(
# A URL to fetch the HTML source from.
url: String
# A string containing HTML to be used as the source document.
source: String
): Document
}
@nberlette
nberlette / starship.toml
Created June 2, 2022 23:36 — forked from pythoninthegrass/starship.toml
Starship prompt setup
# SOURCE: https://starship.rs/config
# DEBUG via: `starship explain`
# Timeout for commands executed by starship (ms)
command_timeout = 1000
# Replace the "❯"
[character]
success_symbol = "[λ](green)"
/**
* Maps a callback to an element in an array-like object
* Basically a copy of underscore's _.each
* source: http://underscorejs.org/docs/underscore.html#section-20
*/
export function forEach(obj, iteratee, context) {
let ctx = this;
const isObject = function(obj) {
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@nberlette
nberlette / .npm-init.js
Created March 28, 2022 18:11 — forked from afj176/.npm-init.js
example .npm-init.js
var fs = require('fs'),
path = require('path'),
homeDir = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
gitConfig = path.join(homeDir, '.gitconfig'),
cwd = process.cwd(),
name = cwd.split('/').pop();
/*
decode function and required functions copied from
https://github.com/npm/ini
in order to parse github config without added reqs
@nberlette
nberlette / orgy-location.md
Last active March 24, 2022 17:18 — forked from aidswidjaja/ghlorg.md
GitHub custom organization locations

Set custom GitHub organization locations, like this one:

image

Since GitHub tries to make you choose from countries now, just use the API to get around it.

curl -X PATCH -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" \
        https://api.github.com/orgs/$ORGANIZATION -d '{"location":"localhost:420"}'