Skip to content

Instantly share code, notes, and snippets.

View cvan's full-sized avatar

Christopher Van cvan

View GitHub Profile
cvan /
Last active October 10, 2023 03:16 — forked from nikias/
Build libimobiledevice stack for macOS with ease
# If you like this script and my work on libimobiledevice, please
# consider becoming a patron at - Thanks <3
if test -x "`which tput`"; then
ncolors=`tput colors`
if test -n "$ncolors" && test $ncolors -ge 8; then
View Caddyfile
# generated 2023-10-04, Mozilla Guideline v5.7, Caddy 2.1.1, intermediate configuration
# note that Caddy automatically configures safe TLS settings
# replace with your domain name
# Due to a lack of DHE support, you -must- use an ECDSA cert to support IE 11 on Windows 7
tls {
protocols tls1.2 tls1.3
cvan /
Last active October 4, 2023 19:13
launch mongodb's mongod daemon on macOS boot

Edit the plist file

Add the following XML content to the plist file. Replace /usr/local/bin/mongod with the correct path to your MongoDB executable if it's different. You may also need to adjust other settings like the data directory or log paths.

Launch Terminal. Create this new file:

nano ~/Library/LaunchAgents/com.mongodb.mongod.plist

Paste the following:

cvan /
Created August 7, 2023 05:09
GitHub Org Archiver — using gh cli:
echo "<\!doctype html><html><meta charset='utf-8'><title>$org_slug</title></head><body><code><pre>$(gh repo list $org_slug --limit $repo_limit)</pre></code></body></html>""$NL" > index.html
cvan / controlled.jsx
Created July 16, 2023 23:33
DecimalInput • react component - input field with 0.000 precision
View controlled.jsx
import React, { useState } from 'react';
const DecimalInput = () => {
const [value, setValue] = useState('');
const handleInputChange = (event) => {
const newValue =;
// If the new value is empty, or it matches the decimal pattern, update the value.
if (newValue === '' || /^-?\d*[.,]?\d{0,3}$/.test(newValue)) {
cvan /
Last active October 4, 2023 19:16
mongodb delete all documents in every collection
mongosh 'mongodb+srv://' --apiVersion 1 --username YOUR_ADMIN_USERNAME
> Enter password:
(enter password)
cvan /
Last active October 4, 2023 19:17
play radiooooo using a CLI on the command-line terminal

play from the terminal

From the comfort of your desktop computer, would you like to play the lovely sounds of without having to create an account, log in, and open your browser?

An awesome individual, @olshevskiy87, wrote a command-line interface (CLI) for goradiooooo

Paste this bash script in somewhere handy, such as ~/bin/rdio ($HOME/bin/rdio).

mkdir -p "$HOME/bin/";
cvan / debug.css
Created May 4, 2023 08:22
css debug - with nested outlines for DOM levels
View debug.css
* {
outline: 2px dotted red;
* * {
outline: 2px dotted green;
* * * {
outline: 2px dotted orange;
cvan /
Created April 19, 2023 02:36
reuse SVG multiple times on same web page


demo of rendering templated SVGs by defining the shape once

Creating SVG templated elements

Why? Less code is sent down the wire to the user ("the client," the browser). This means faster page load times since it's less code. As a principle, a smaller and flatter DOM structure is going to perform better in the browser. In general, the larger the DOM node tree, the slower, manipulations to the structure will be more expensive by the browser's layout system.

cvan /
Created April 13, 2023 19:16
debug show print reveal github secrets in github actions workflows jobs