Skip to content

Instantly share code, notes, and snippets.

View patillacode's full-sized avatar
🍕
I'm generally a very pragmatic person: that which works, works. - Linus Torvalds

Patilla Code patillacode

🍕
I'm generally a very pragmatic person: that which works, works. - Linus Torvalds
View GitHub Profile
#!/bin/bash
################################################################################
# cap - capture your screen
#
# This script allows you to capture your screen on Linux or macOS systems using
# the appropriate tools available on each platform. On Linux, it uses 'slop'
# and 'ffmpeg', while on macOS, it utilizes 'screencapture'. The script prompts
# you to select a desktop area for recording and saves the recording as an MP4/MOV
# file with customizable video quality.
@patillacode
patillacode / asciinema_in_readme.sh
Created July 22, 2023 21:16
asciinema in your README
# generate asciinema (ctrl-D) to exit when done
asciinema rec -t my-demo
# convert asciinema into svg via svg-term (https://github.com/marionebl/svg-term-cli)
svg-term --cast=598561 --out examples/demo.svg --window
# add svg to your markdown file aka README
![asciinema](./examples/demo.svg)
@patillacode
patillacode / telegram_send.sh
Created November 30, 2023 19:52
telegram send mesage
#!/bin/bash
# credit to: jogerj (https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1?permalink_comment_id=4327762#gistcomment-4327762)
TELEGRAM_BOT_TOKEN="botid:token"
CHAT_ID="1234567890"
send_telegram () {
title="$1"
timestamp="$(date -R)"
msg="$title\n$timestamp\n\n$(echo "$2" | sed -z -e 's|\\|\\\\|g' -e 's|\n|\\n|g' -e 's|\t|\\t|g' -e 's|\"|\\"|g')"
@patillacode
patillacode / __init__.py
Created March 7, 2024 11:18
Wagtail - Avoid Streamfields in Django migrations
import wagtail.fields
def deconstruct_without_block_definition(self):
name, path, _, kwargs = super(wagtail.fields.StreamField, self).deconstruct()
block_types = list()
args = [block_types]
return name, path, args, kwargs