Skip to content

Instantly share code, notes, and snippets.

View csandman's full-sized avatar

Chris Sandvik csandman

View GitHub Profile
@alberteddu
alberteddu / copy-attachments.js
Created January 15, 2021 10:39
Server and copy attachments
// util/copy-attachments.js
// This is supposed to copy all files to the url where next.js expects them as a static file.
// The example I have is too tailored to my library to make any sense to anyone else.
// However, the theory is: static file is expected at /some/url/hey.png
// When running next.js in dev, server.js will serve this url instead, because this file is not in
// the public folder, but is instead in the content folder I manage.
// When building, I run this script (see package.json example below) which will move hey.png
// to public/some/url/hey.png.
@jheddings
jheddings / ex-notes.py
Last active October 23, 2025 08:52
Import Apple Notes into Notion.
#!/usr/bin/env python3
# !! NOTE - this script is no longer maintained... please see the repo for further
# updates: https://github.com/jheddings/notes2notion
# this script attempts to migrate from Apple Notes to Notion while retaining as
# much information and formatting as possible. there are limitations to the
# export data from Notes, so we try to preserve the intent of the original note.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
@myisaak
myisaak / Dockerfile
Last active June 8, 2025 16:53
Puppeteer with Alpine inside multi-staged Dockerfile
FROM node:13-alpine as base
LABEL maintainer="Isaak Eriksson <[email protected]>"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
WORKDIR /src
RUN apk update && apk add --no-cache --virtual \
@fanfare
fanfare / gist:0fa525af28b275fd6623942d7e9d70dd
Created November 22, 2020 08:17
mp3 inside mp4 via javascript
// input MUST be 128kbps cbr mp3 with no album art (and probably no id3, untested)
const encapsulatemp3insidemp4 = (function() {
// firefox mediasource extensions support
// encapsulate cbr 128 kbps mp3 inside audio/mp4
// jollo.org 0BSD or LNT
const encapsulation = (function() {
function bumpsum(prev, pad, inc) {
@roblogic
roblogic / zshexpn-explained.md
Created November 19, 2020 01:49
Regular Expressions in Zsh

The following is taken from a brilliant answer on unix.se. Posting it here for personal reference. The question was:

${var//pattern/replacement} is using zsh wildcard patterns for pattern, the same ones as used for filename generation aka globbing which are a superset of the sh wildcard patterns. The syntax is also affected by the kshglob and extendedglob options. The ${var//pattern/replacement} comes from the Korn shell initially.

I'd recommend enabling extendedglob (set -o extendedglob in your ~/.zshrc) which gives you the most features (more so than standard EREs) at the expense of some backward incompatibility in some corner cases.

You'll find it documented at info zsh 'filename generation'.

@baumandm
baumandm / Chakra-UI x React-datepicker.md
Last active May 29, 2024 05:29
Chakra-UI x React-datepicker

⚠️ I'd recommend using this fork by @igoro00 which has better theme support.


Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />
@fixpunkt
fixpunkt / remove-empty-directories.js
Last active June 18, 2023 20:14
nodejs: remove empty directories recursively, async version of https://gist.github.com/jakub-g/5903dc7e4028133704a4
const fsPromises = require('fs').promises;
const path = require('path');
/**
* Recursively removes empty directories from the given directory.
*
* If the directory itself is empty, it is also removed.
*
* Code taken from: https://gist.github.com/jakub-g/5903dc7e4028133704a4
*
@fazlurr
fazlurr / ContentEditor.vue
Last active April 30, 2024 15:39
tiptap alignment And custom image handler
<template>
<!-- WYSIWYG Editor -->
<div class="editor mb-4">
<editor-menu-bar class="editor-bar" :editor="editor">
<div slot-scope="{ commands, isActive, focused, getMarkAttrs }">
<!-- Image -->
<label
class="btn btn-plain mb-0"
:class="{ 'is-loading': isUploading }"
v-tooltip="'Add Image'">
@mallendeo
mallendeo / syslinux.conf
Last active October 9, 2024 11:38
Unraid boot config
kernel /bzimage
append
isolcpus=2-7,10-15
pcie_acs_override=downstream,multifunction
pci-stub.ids=14e4:43a0
vfio-pci.ids=8086:a348,10de:10f8,10de:1ad8,1b73:1100,8086:24f3,14e4:43a0
pci=noaer
modprobe.blacklist=amdgpu,wl,bluetooth,b43
kvm.ignore_msrs=1
vfio_iommu_type1.allow_unsafe_interrupts=1
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active October 12, 2025 21:26
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size