Skip to content

Instantly share code, notes, and snippets.

@ryanburnette
ryanburnette / Caddyfile
Last active May 13, 2024 10:55
Caddy v2.1+ CORS whitelist
(cors) {
@cors_preflight{args.0} method OPTIONS
@cors{args.0} header Origin {args.0}
handle @cors_preflight{args.0} {
header {
Access-Control-Allow-Origin "{args.0}"
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
Access-Control-Allow-Headers *
Access-Control-Max-Age "3600"
@KalebNyquist
KalebNyquist / lookupZoteroCollections.js
Created August 8, 2021 21:44
One of my frustrations with Zotero is that there is no easy way to list all the collections in which a file is stored. This is my band-aid of a solution. The code can be run under Tools > Developer > Run Javascript using "Sync" mode.
// Instructions:
// (1) Highlight file of interest.
// (2) Run code in Zotero's JavaScript console (found under Tools > Developer > Run Javascript) in sync mode.
function collections_output() {
zp = Zotero.getActiveZoteroPane()
items = zp.getSelectedItems()
collection_ids = items[0]["_collections"]
collections_cache = Zotero.Collections._objectCache
@slimlime
slimlime / uupdump ConvertConfig.ini explained.md
Created October 8, 2022 22:45
uupdump ConvertConfig.ini explained (convert-UUP, AutoStart, AddUpdates, Cleanup, ResetBase, NetFx3, StartVirtual, wim2esd, wim2swm, SkipISO, SkipWinRE, LCUwinre, UpdtBootFiles, ForceDism, RefESD, SkipEdge, AutoExit, Store_Apps, SkipApps, AppsLevel, CustomList, create_virtual_editions, vAutoStart, vDeleteSource, vPreserve, vwim2esd, vwim2swm, vS…

note: some of the information is posted in comments,
if you'll fork this gist, you'll loose that information,
it is best to just bookmark this one..

WIM

WIM (ESD,SWM) is an image of an OS file system,
it can be mounted, and modified (to some degree) .
there are two possible ways, through DISM or through mounting it directly through an older way, using a driver named imagex (Windows Imaging Utility).
regardless,

terminology

@ckandoth
ckandoth / install_nextflow_singularity.md
Last active May 13, 2024 10:51
Install conda and use it to install nextflow and singularity

This guide will show you how to install conda and then use it to install nextflow and singularity for executing popular bioinformatics workflows. Unfortunately, singularity is not available on Windows or macOS. So, this guide will only target Linux environments. If you have to use Windows 10, then try WSL2. If you have to use macOS, then try a Virtual Machine.

Download the Miniconda3 installer for Linux environments:

curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh

Install into a folder named miniconda3 under your home directory, and delete the installer:

bash miniconda.sh -bup $HOME/miniconda3 && rm -f miniconda.sh
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@dev-niiaddy
dev-niiaddy / QRPainter.kt
Last active May 13, 2024 10:47
A function to encode text as a QR code using BitmapPainter and zxing-core for use in jetpack compose with Image composable.
@Composable
fun rememberQrBitmapPainter(
content: String,
size: Dp = 150.dp,
padding: Dp = 0.dp
): BitmapPainter {
val density = LocalDensity.current
val sizePx = with(density) { size.roundToPx() }
val paddingPx = with(density) { padding.roundToPx() }
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@mikeananev
mikeananev / scratch_2.txt
Created May 3, 2021 07:50
MacOS mc Midnight commander open jar file
# jar
shell/i/.jar
Open=%cd %p/uzip://
View=%view{ascii} /usr/local/Cellar/midnight-commander/4.8.26/libexec/mc/ext.d/archive.sh view zip
# jar
type/i/^jar\ archive
Open=%cd %p/uzip://
View=%view{ascii} /usr/local/Cellar/midnight-commander/4.8.26/libexec/mc/ext.d/archive.sh view zip
import { useEffect, useState } from "react"
import { motion } from "framer-motion"
import { addPropertyControls, ControlType } from "framer"
import Masonry, { ResponsiveMasonry } from "react-responsive-masonry"
import React from "react"
// Welcome to Code in Framer
// Get Started: https://www.framer.com/docs/guides/
/**
@kentbrew
kentbrew / lang_chrome_osx.md
Last active May 13, 2024 10:40
How to change the Chrome default language on OSX

How to Change your Chrome Default Language

Open up a Terminal window. (If you have never seen Terminal before, go to Spotlight Search and type "Terminal.")

In the Terminal box, try this:

defaults read com.google.Chrome AppleLanguages

If you see this: