Skip to content

Instantly share code, notes, and snippets.

View tvst's full-sized avatar
🦙

Thiago Teixeira tvst

🦙
View GitHub Profile
@tvst
tvst / Code.gs
Last active October 21, 2022 22:21
Move folder to Shared Drive (AppsScript)
const FOLDER_ID_TO_MOVE = 'FOLDER ID GOES HERE'
const DESTINATION_FOLDER_ID = 'FOLDER ID GOES HERE'
function main() {
const folderToMove = DriveApp.getFolderById(FOLDER_ID_TO_MOVE)
const newParentFolder = DriveApp.getFolderById(DESTINATION_FOLDER_ID)
moveFolder(folderToMove, newParentFolder)
}
function moveFolder(folderToMove, newParentFolder) {
@tvst
tvst / state_class_patch.py
Last active November 19, 2025 16:34
An alternative API for st.session_state using a class decorator.
"""An alternative API for st.session_state using a class decorator.
So instead of doing this...
if "run_counter" in st.session_state:
st.session_state.run_counter = 0
st.session_state.run_counter += 1
st.write("Number of reruns:", st.session_state.run_counter)
@tvst
tvst / streamlit_app.py
Last active July 20, 2025 13:52
Simple way to run heavy computations without slowing down other Streamlit users
import streamlit as st
import concurrent.futures # We'll do computations in separate processes!
import mymodule # This is where you'll do the computation
# Your st calls must go inside this IF block.
if __name__ == '__main__':
st.write("Starting a long computation on another process")
# Pick max number of concurrent processes. Depends on how heavy your computation is, and how
# powerful your machine is.