Skip to content

Instantly share code, notes, and snippets.

@fnky
fnky / ANSI.md
Last active May 21, 2024 17:06
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@rxaviers
rxaviers / gist:7360908
Last active May 21, 2024 16:56
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@mabarbeau
mabarbeau / git-rebase-auto-resolve-yarn-lock.zsh
Last active May 21, 2024 16:56
A `git rebase` that auto resolves conflicts in yarn.lock
rebase () {
if [ $# -ne 0 ]; then;
locks=$(find . -name "yarn.lock" -not -path "./node_modules/*" -not -path "*/node_modules/*" | tr '\n' ' ')
output=$(git rebase $@) && echo $output
if echo $output | grep 'CONFLICT' | grep -q 'yarn.lock'; then
echo -e "\n\033[4;33mConflicts found in yarn.lock\n\033[0m\033[2;20mAuto merging\033[0m\n" \
&& git checkout $1 -- $(echo $locks) \
&& yarn install \
@loretoparisi
loretoparisi / github_quick_setup.md
Last active May 21, 2024 16:54
Github Quick setup β€” if you’ve done this kind of thing before

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

echo "# myrepo" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/loretoparisi/myrepo.git
git push -u origin master
@kuntau
kuntau / yify.md
Last active May 21, 2024 16:51
YIFY's Quality Encoding

For those that want to keep the YTS going (No, IDGAF about people that don't care for YTS quality) get HandbrakeCLI https://handbrake.fr/downloads... and use the following settings:

user@user:~$HandBrakeCLI -i /file/input.mp4 -o /file/out.mp4 -E fdk_faac -B 96k -6 stereo -R 44.1 -e x264 -q 27 -x cabac=1:ref=5:analyse=0x133:me=umh:subme=9:chroma-me=1:deadzone-inter=21:deadzone-intra=11:b-adapt=2:rc-lookahead=60:vbv-maxrate=10000:vbv-bufsize=10000:qpmax=69:bframes=5:b-adapt=2:direct=auto:crf-max=51:weightp=2:merange=24:chroma-qp-offset=-1:sync-lookahead=2:psy-rd=1.00,0.15:trellis=2:min-keyint=23:partitions=all

Reason to use CLI over GTK has to do with lack of support for advanced settings for Handbrake GTK

** Don't Re-encode already shitty encodes...get good source!**

@spajak
spajak / mpeg2mkv-steps.ps1
Last active May 21, 2024 16:50
Convert/rip DVD to MKV. Encode to MPEG-4 & merge into MKV - all without GUI, only command line tools
# My steps to:
# Convert DVD Video to MPEG-4 in MKV without GUI, using only CLI (Command Line Interface) tools.
# No need for MeGUI, Avisynth, Handbrake etc..
# ------------------------------------------------------------------------------
# Tools needed: `mediainfo`, `ffmpeg` & `ffprobe`, `x264`, `mkvmerge`, `mplayer` (optional).
# Google for them. Use latest versions. Windows tip: avoid Cygwin and get
# the official builds, x64, when possible.
# Before start use `mediainfo` & `ffprobe` and note down informations about the source material:
@deepcoder
deepcoder / birdnet_to_mqtt.py
Last active May 21, 2024 16:49
BirdNET to MQTT publishing for Home Assistant consumption
#! /usr/bin/env python3
# birdnet_to_mqtt.py
#
# 202306171542
#
# monitor the records in the syslog file for info from the birdnet system on birds that it detects
# publish this data to mqtt
#
import time
@ckwastra
ckwastra / initialization-in-cpp-a-corner-case.md
Last active May 21, 2024 16:49
Initialization in C++: A Corner Case

Initialization in C++: A Corner Case

Recently, I've been trying to find out the difference between copy-initialization (e.g. in return statements) and direct-initialization (e.g. in static_cast expressions). Besides the explicit keyword, the code posted by [Johannes] really caught my attention because recent versions of GCC and Clang exhibit different behaviors for the mentioned code. Upon further investigation, it may be surprising that these behaviors are somewhat intentional. In the following, I will try to explain this corner case of initialization in C++. This post may be a bit arcane. Anyway, have fun reading!

Introduction

Given the following code:

// -std=c++23
@dvf
dvf / change-codec.md
Last active May 21, 2024 16:48
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (βŒ₯) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop hereβ€”those are the highest quality codecs.

Change your codec to AAC or aptX

@TALlama
TALlama / anonymizer.rb
Created May 17, 2024 16:03
This class will use your existing FactoryBot factories to rewrite the data already in the db, keeping the associations and structure but replacing the content.
class Anonymizer
include ActiveSupport::Benchmarkable
attr_reader :factory_names, :callbacks
def initialize(factory_names = nil, callbacks = {})
raise ArgumentError.new("You must be in development to use the anonymizer") unless Rails.env.development?
require Rails.root.join("spec/factories") unless FactoryBot.factories.count > 0
@factory_names = [*factory_names].compact.map(&:to_sym)