Skip to content

Instantly share code, notes, and snippets.

@rafaelcaricio
rafaelcaricio / Toothbrush_holder.stl
Last active September 4, 2023 15:04
Toothbrush Holder Model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// ==UserScript==
// @name Mastodon Bird UI Conversafiada.net
// @match https://conversafiada.net/*
// @grant GM_addStyle
// @grant GM_getResourceText
// @version 2
// @description A UserScript that applies the Mastodon Bird UI style to conversafiada.net
// @resource layout-single-column https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/master/layout-single-column.css
// @resource layout-multiple-columns https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/master/layout-multiple-columns.css
// @downloadURL https://gist.github.com/rafaelcaricio/096231368e9391ed703fcde16c433a8c/raw/mastodon-bird-ui.user.js
@rafaelcaricio
rafaelcaricio / api.py
Created April 25, 2016 12:34
Custom type format - Connexion
import logging
import re
from connexion import App
from jsonschema import draft4_format_checker
MONEY_RE = re.compile('^\$\s*\d+(\.\d\d)?')
logging.basicConfig(level=logging.DEBUG)
@rafaelcaricio
rafaelcaricio / ffmpeg_bars_and_tone_stream.sh
Created January 16, 2023 15:23 — forked from tjensen/ffmpeg_bars_and_tone_stream.sh
FFMPEG command for generating a "bars and tone" RTMP live stream
ffmpeg -re \
-f lavfi -i "smptebars=rate=30:size=640x360" \
-f lavfi -i "sine=frequency=1000" \
-vf drawtext="text='%{pts\:hms}':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black" \
-f flv \
-vcodec libx264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 \
-acodec aac \
rtmp://streaming-server/live/key
@rafaelcaricio
rafaelcaricio / application.py
Created July 8, 2021 09:00
Why not just use async Python for this API?
from fastapi import FastAPI
import requests
import httpx
import uuid
import logging
logging.basicConfig(format="%(asctime)s %(message)s")
log = logging.getLogger("myapp")
log.setLevel(logging.DEBUG)
@rafaelcaricio
rafaelcaricio / howto.md
Last active December 4, 2019 15:17
Using git bisect

Using git bisect

Git provides a simple way to find out where some code was modified or removed from your codebase. You can use git bisect for that and the processes can be completely automated.

As example I will try to find out when the method send_email_notification was removed from the file app/models/person.rb. So you have to create a automated bash file, or other kind of script, that should return 0 when the method is found and 1 otherwise. So git can run this script for each commit until it returns 1, which means that the method was removed in that commit. There's the script we gonna use:

if [[ `cat app/models/person.rb | grep send_email_notification` ]]; then
@rafaelcaricio
rafaelcaricio / example_app.py
Last active May 19, 2019 17:22
Blog post example using Request ID in Async I/O Python app
import re
import asyncio
import logging
import logging.config
import uuid
from aiohttp import web
import aiotask_context as context
@rafaelcaricio
rafaelcaricio / dabblet.css
Created February 19, 2013 16:41
Example of carrossel CSS only simplified
/**
* Example of carrossel CSS only simplified
*/
/* this part is just look-and-feel */
.just-to-centralize-not-related-to-the-example {
display: inline-block;
margin-top: 20px;
text-align: center;
width: 100%;
}
# https://github.com/kubernetes/contrib/blob/master/ingress/controllers/nginx/examples/default-backend.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: default-http-backend
spec:
replicas: 1
selector:
app: default-http-backend
template: