Skip to content

Instantly share code, notes, and snippets.

@fgr0
fgr0 / _tmutil
Last active January 10, 2023 00:14
zsh autocompletion for macOS tmutil
#compdef tmutil
# Autocompletion for macOS `tmutil`
#
# utility functions
#
# tmutil <verbs>
__tmutil_verbs() {
local -a allverbs
@patrickfuller
patrickfuller / alias_dns.py
Last active August 4, 2024 05:00
Enables local DNS resolution of Unifi aliases
"""
When run in cron, automatically adds compliant alias names to local DNS.
Use at your own risk.
Patrick Fuller, 25 June 17
"""
import re
import paramiko
import pymongo
@schollz
schollz / pet-snippet.toml
Last active December 7, 2022 11:08
description
[[snippets]]
description = "Grep all files in a folder"
command = "grep -rn \"texthere\" ."
output = ""
[[snippets]]
description = "Sync only certain files using filters and rsync"
command = "rsync -rv --include '*/' --include '*something*' --exclude '*' --prune-empty-dirs Source/ Target/"
output = ""
@varenc
varenc / pet-snippet.toml
Last active April 18, 2025 01:41
description
[[Snippets]]
Description = "my personal snippets. Relies on many of my own functions. If you're interested in pmset/disabling assertions, see: https://gist.github.com/varenc/627f6be2a5ec9d52dab3cf0d157be62f"
Output = ""
Tag = []
command = ""
[[Snippets]]
Description = "start dev file syncer. uses fswatch to know when to run rsync. does not sync .git file. Sort like a write-through cache network file system with only eventual consistency guarantees."
Output = ""
@cmdoptesc
cmdoptesc / .macos
Created February 17, 2017 08:46
Mathias Bynen's macOS defaults script
#
# Originally..
# https://github.com/mathiasbynens/dotfiles/blob/master/.macos
#
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 8, 2025 13:32
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@pedroxs
pedroxs / jq-filters.sh
Last active March 22, 2025 00:02
jq - recursive search for keys containing "string" stripping empty results
# recursive search for keys containing "string" stripping empty results
jq '.. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {})'
# same, but output propper array
jq '[ .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) ]'
# or
jq 'map( .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) )'
# transform input from {type: a, amount: 1} to {a: 1} and sum all values by type
jq '[ .[] | {(.type): .amount} ] | map(to_entries) | add | group_by(.key) | map({key: .[0].key, value: map(.value) | add}) | from_entries'
@frafra
frafra / mbox2html.py
Last active February 22, 2025 03:24
Mailbox to HTML conversion using Python 3 + Jinja2 in less than 100 lines (including GPLv3 license)
#!/usr/bin/env python3
#
# Copyright (C) 2016 - Francesco Frassinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@mikoim
mikoim / README.md
Last active March 30, 2025 06:04
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@igv
igv / SSimSuperRes.glsl
Last active April 14, 2025 14:35
Basically it's an accurate sharpener + antiringing. Usage: glsl-shader="~~/SSimSuperRes.glsl"
// SSimSuperRes by Shiandow
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU