Skip to content

Instantly share code, notes, and snippets.

View shuantsu's full-sized avatar

Filipe Teixeira shuantsu

View GitHub Profile
@shuantsu
shuantsu / AndroidManifest.xml
Last active December 11, 2024 09:41
chaquopy snippets
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
// Utility micro library "LocalStorj"
const LocalStorj = {
get: (key, defaultValue = null) => {
const result = localStorage.getItem(key)
if (result === null) {
return defaultValue;
}
return result;

ANDROID KOTLIN SWIPE TO REFRESH IMPLEMENTATION


Adicionar ao app o recurso de deslizar para atualizar

dependencies {
    implementation(libs.androidx.swiperefreshlayout)
}

KOTLIN + OKHTTP3


Dependency

com.squareup.okhttp3:okhttp:4.12.0

Get

KOTLIN WEBVIEW (HTML+CSS+JS HYBRID ANDROID APP)


Useful snippets

MainActivity.kt

@shuantsu
shuantsu / app.py
Last active February 28, 2025 15:37
Sintetizador de voz da microsoft edge em script Python
'''
exemplo de uso: python app.py artigo.txt
lembre de instalar esses módulos:
asyncio
edge_tts
@shuantsu
shuantsu / main.py
Created September 5, 2023 01:36
total audio length
import tinytag
import glob
import sys
def get_mp3_duration(filename):
"""Function to get the duration of an MP3 file using TinyTag"""
tag = tinytag.TinyTag.get(filename)
return tag.duration
def format_duration_in_minutes_seconds(seconds):
@shuantsu
shuantsu / create-python-app.sh
Last active July 2, 2023 02:28
Create Python App
#!/usr/bin/bash
log_file="/home/$USER/Projects/log.txt"
export LC_ALL="en_US.UTF-8"
exec > >(tee -a "$log_file") 2>&1
function create-python-app() {
echo "Creating and entering folder..."
mkdir $1
@shuantsu
shuantsu / Debugger.py
Last active June 22, 2023 18:34
Debugger context manager in python
#!/usr/bin/env python3
import time
class Debugger:
debug = True
def __init__(self, message):
self.message = message
self.t1 = time.time()
def __enter__(self):