Skip to content

Instantly share code, notes, and snippets.

View peterc's full-sized avatar
🏠
Working from home

Peter Cooper peterc

🏠
Working from home
View GitHub Profile

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@sburns
sburns / example-lambda-gha.yml
Last active December 4, 2020 23:23
This is an example GitHub Actions workflow to continuously deploy a Lambda function.
name: example CICD
on:
push:
branches:
- master
paths:
# only commits containing changes under these paths will trigger this workflow
- 'services/example/**'
- 'lib/example/**'
@texodus
texodus / .block
Last active June 4, 2022 04:41
regular-table / Minesweeper
license: apache-2.0
@PierBover
PierBover / explanation.md
Created May 8, 2020 15:55
FQL recursive function to get nested documents

This is how you'd call the function:

Call(Function("GetNestedDocument"), [Ref(Collection("SomeCollection"), "264260207986606612"), 0, 3])

Parameters:

  • A Ref of a document.
  • Current depth. Since AFAIK we cannot have default values in Lambda we need to pass 0 for the first level.
  • Max depth. The max number of levels the recursive function will go.
@miry
miry / 01_dynamodb_get_all.rb
Last active September 30, 2022 02:53
Sample to get all items from DynamoDB table
# frozen_string_literal: true
require 'aws-sdk-dynamodb'
require 'hirb'
# NOTICE: Authorize via https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
dynamodb = Aws::DynamoDB::Client.new
scan_opts = { table_name: '<TABLE_NAME>' }
items = []
@IanColdwater
IanColdwater / twittermute.txt
Last active June 15, 2025 16:53
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@moyix
moyix / tree.sh
Created December 16, 2019 23:45
A very silly script to make a Christmas tree with 224 cores in htop
# Upper
cpulimit -l 1 -- taskset -c 0 ./pct
cpulimit -l 18 -- taskset -c 1 ./pct
cpulimit -l 35 -- taskset -c 2 ./pct
cpulimit -l 52 -- taskset -c 3 ./pct
cpulimit -l 69 -- taskset -c 4 ./pct
cpulimit -l 86 -- taskset -c 5 ./pct
cpulimit -l 103 -- taskset -c 6 ./pct
cpulimit -l 1 -- taskset -c 63 ./pct
@ChristopherA
ChristopherA / FFmpeg.sh
Created November 30, 2019 03:01 — forked from AffanIndo/FFmpeg.sh
FFmpeg Cheat Sheet
# batch convert
for i in *.mp4; do ffmpeg -i "$i" "${i%.mp4}.webm"; done
# convert from one format to another
ffmpeg -i input.mp3 output.wav
# convert from one video format to another ("-qscale" value are 0-10, 0 is the best)
ffmpeg -i input.mp4 -qscale 0 output.webm
# convert video to audio (sometimes this one is better than the custom one below)
@webchi
webchi / Dockerfile
Created October 11, 2019 13:08
Rails Postgre Docker MultiStage
FROM ruby:2.5.5-alpine3.9 as builder
WORKDIR /app
ARG RAILS_MASTER_KEY
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_IGNORE_MESSAGES=1 \
BUNDLE_GITHUB_HTTPS=1 \
BUNDLE_FROZEN=1 \
@htr3n
htr3n / macos-ramdisk.md
Last active May 19, 2025 09:57
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes: