Skip to content

Instantly share code, notes, and snippets.

View pixelmaven's full-sized avatar

Zac Evans pixelmaven

View GitHub Profile
@snorrees
snorrees / collectionUpdate.ts
Created March 15, 2023 14:33
Sanity Connect custom handler. See requirements.md
import type {SanityClient} from '@sanity/client'
import {v5 as uuidv5} from 'uuid'
import {buildCollectionDocumentId, commitCollectionDocument} from './sanityOps'
import type {ShopifyDocumentCollection} from './storageTypes'
import {SHOPIFY_COLLECTION_DOCUMENT_TYPE, UUID_NAMESPACE_COLLECTIONS} from './constants'
import {DataSinkCollection} from './requestTypes'
import {idFromGid} from './requestHelpers'
@MaxHalford
MaxHalford / ogd-in-sql.ipynb
Created March 7, 2023 12:32
Online gradient descent written in SQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@parterburn
parterburn / custom_warp_script.applescript
Created September 27, 2022 16:51
An easy way to use the Warp terminal (https://www.warp.dev/) with Alfred.
-- For the latest version:
-- https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82
-- Set this property to true to always open in a new window
property open_in_new_window : false
-- Set this property to false to reuse the current tab
property open_in_new_tab : true
-- Handlers
@scyto
scyto / debian-vm-install.md
Last active November 30, 2025 15:23
Installing Debian as VM

This is the base of all my linux VM installs I use for docker etc

Prep Hypervisor (instructions vary based on hypervisor so this is generic)

  • Download netinst ISO from debian website
  • Create a VM on your hypervsor
  • VM Machine Spec:
    • 200GB
    • 2 CPU
    • 4GB RAM
    • Attach to external network
@arctic-hen7
arctic-hen7 / Dockerfile
Last active September 5, 2024 03:23
Starter Dockerfile with ZSH (NodeJS)
# Setup Stage - set up the ZSH environment for optimal developer experience
FROM node:14-alpine AS setup
# Let scripts know we're running in Docker (useful for containerised development)
ENV RUNNING_IN_DOCKER true
# Use the unprivileged `node` user (pre-created by the Node image) for safety (and because it has permission to install modules)
RUN mkdir -p /app \
&& chown -R node:node /app
# Set up ZSH and our preferred terminal environment for containers
RUN apk --no-cache add zsh curl git
RUN mkdir -p /home/node/.antigen
@arctic-hen7
arctic-hen7 / .dockershell.sh
Last active September 5, 2024 03:21
ZSH configuration for nice Docker shells in Alpine
# Note: for this to do anything, use my starter Dockerfile config (https://gist.github.com/arctic-hen7/10987790b86360820e2790650e289f0b)
# This file contains ZSH configuration for your shell when you interact with a container
# (we wouldn't want any boring `sh` now would we?)
# Please feel free to set up your own ZSH config in here!
# It gets mapped to your `.zshrc` for the root user in the container
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
@matchu
matchu / README.md
Last active July 7, 2021 10:29
Fork of Apollo Server's cache-control plugin, with stale-while-revalidate support

Hi! This is a plugin I hacked together, to add another field staleWhileRevalidate to Apollo Server's @cacheControl directive!

To use this, you'll need to disable the built-in plugin by setting cacheControl: false in your Apollo Server config.

Then, add this plugin, and initialize it with the option calculateHttpHeaders: true (which Apollo Server normally enables by default).

const server = new ApolloServer({
    // ...
 cacheControl: false,
@AtulKsol
AtulKsol / db_backup_commands.md
Last active December 28, 2024 02:23
Commands to backup & restore database
  1. pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
    Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql

    Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql

    -h is for host.
    -p is for port.
    -U is for username.
    -d is for database.

@markerikson
markerikson / render-logic.js
Last active December 30, 2025 22:05
React render function organization
// See https://blog.isquaredsoftware.com/presentations/react-redux-ts-intro-2020-12/#/36 for slides
// My basic render function structure:
function RenderLogicExample({
someBoolean, // 1) Destructure values from `props` object
someList,
}) {
// 2) Declare state values
const [a, setA] = useState(0);
const [b, setB] = useState(0);
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active March 19, 2026 23:02
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04