Skip to content

Instantly share code, notes, and snippets.

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

Jônatas Davi Paganini jonatas

🏠
Working from home
View GitHub Profile
@lucataco
lucataco / ollama_fast_speech_text_speech.py
Last active November 27, 2025 16:53
speech to text to speech using Ollama
""" To use: install Ollama, clone OpenVoice, run this script in the OpenVoice directory
brew install portaudio
brew install git-lfs
git lfs install
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
@matanper
matanper / parquet_to_tsdb.py
Last active September 5, 2024 18:57
Loading parquet files from S3 into timescaledb
import boto3
import os
import time
from subprocess import Popen, PIPE
import pyarrow.parquet as pq
import pickle
import hashlib
TSDB_CPUS = 8
@cevian
cevian / uuid.sql
Last active August 30, 2023 19:36
uuids
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
CREATE OR REPLACE FUNCTION uuid_timestamp(uuid UUID) RETURNS TIMESTAMPTZ AS $$
DECLARE
bytes bytea;
BEGIN
bytes := uuid_send(uuid);
if (get_byte(bytes, 6) >> 4)::int2 != 1 then
RAISE EXCEPTION 'UUID version is not 1';
@fxi
fxi / chatgpt.rb
Created December 16, 2022 20:19
ChatGPT generated song
use_bpm 30
define :chorda do |root, type|
case type
when "major"
[root, root+4, root+7]
when "minor"
[root, root+3, root+7]
end
end
@jonatas
jonatas / poc_100k_hypertables.sql
Last active July 21, 2022 20:47
This is an attempt to create several hypertables and test the setup of millions of chunks
-- First set the numbers of hypertables you'd like to test
\set hypertables_count 100
-- Hypertable configuration with the chunk time interval for every hypertable
\set chunk_time_interval '''1 hour'''
-- How much data you'd like to append for every append_data call
\set append_interval '''1 day'''
-- How many devices would you like to simulate in parallel
\set number_of_devices '''1'''
-- When the data starts
\set start_date '''2000-01-01'''
@clarkbw
clarkbw / create_hypertable_migration.rb
Last active February 10, 2022 17:19
A rails migration for creating and reverting a hypertable
class ActionsHypertable < ActiveRecord::Migration[7.0]
def change
@table_name = 'actions'
@time_column = 'created_at'
reversible do |dir|
dir.up do
execute <<-SQL
SELECT create_hypertable('#{@table_name}', '#{@time_column}', if_not_exists => TRUE, migrate_data => TRUE);
SQL
end
@jonatas
jonatas / hypertable_trigger.sql
Last active January 24, 2022 08:36
Timescale continuous aggregates over top of continuous aggregates - Caggs over top of caggs (POC)
DROP TABLE ticks CASCADE;
DROP TABLE ohlc_1s CASCADE;
CREATE TABLE ticks ( time TIMESTAMP NOT NULL, symbol varchar, price decimal, volume int);
CREATE TABLE ohlc_1s ( time TIMESTAMP NOT NULL, symbol varchar, o decimal, h decimal, l decimal, c decimal, v int);
SELECT create_hypertable('ticks', 'time');
SELECT create_hypertable('ohlc_1s', 'time');
CREATE OR REPLACE FUNCTION feed_ohlc_1s() RETURNS trigger AS
$BODY$
DECLARE
@jonatas
jonatas / Gemfile
Last active August 31, 2021 18:40
TimescaleDB ActiveRecord Helpers
source 'https://rubygems.org'
gem "activerecord", "~> 6.1"
gem "composite_primary_keys", "~> 6.0"
gem "pg", "~> 1.2"
gem 'pry'
@DavidRayner
DavidRayner / wanbo.sh
Last active March 16, 2026 00:14
Wanbo T2 apply custom settings on boot
# Connect to device using adb
adb connect <@IP>
# Start su shell (works out of the box - no need to root device)
adb shell
su
# We need to remount the system file-system in order to modify the start-up script
mount -o remount,rw /system