Skip to content

Instantly share code, notes, and snippets.

View domhel's full-sized avatar

Dominik Helfenstein domhel

View GitHub Profile
@domhel
domhel / flutter_opacity_button.dart
Created November 10, 2024 22:14
Flutter Opacity Button
// Demo video: https://x.com/dominik_hstein/status/1854972653100233132
enum OpacityButtonState {
idle(opacity: 1.0),
hovering(opacity: 0.75),
tapDown(opacity: 0.5, scale: 0.95),
;
final double opacity;
final double scale;
@domhel
domhel / build_stuff.py
Created October 27, 2024 22:57
Flutter build and upload iOS and Android app
#!/usr/bin/env python3
# This script sits in the root of your project = <my_flutter_project>/build_stuff.py
# It requires a directory <my_flutter_project>/keys with the credentials below
import os
import subprocess
import sys
import glob
from google.oauth2.service_account import Credentials
@domhel
domhel / gist:395d97f79e092a1aa3b1d4b8fa4d1ea1
Created August 31, 2024 08:02
Build Flutter Android applications on MacOS
# Prerequisites: flutter, homebrew
# Install Java
brew install --cask temurin@17
# Install android commandline tools
brew install --cask android-commandlinetools
# Put the following into ~/.bashrc or ~/.zshrc (don't execute)
export PATH=$PATH:/opt/homebrew/share/android-commandlinetools
# Not sure if the following command is necessary
flutter config --android-sdk /opt/homebrew/share/android-commandlinetools
# Install sdk (35 works with Flutter 3.24)
@domhel
domhel / combine_git_repos.sh
Last active May 3, 2024 18:57
Combine many git repos into one
# Use-case:
# - We have multiple git repositories but want to merge them together for simplicity / using a monorepo / etc.
# - We can not lose the git history and tags
# - The new structure can be arbitrary
#
# Solution:
# - Create a tmp directory and clone all previous repos
# - Install git filter-repo via pip
# - In each of these repos, use the git filter-repo command to move all files to any new directory inside the repository
# - cd anywhere and create your new repository
@domhel
domhel / create_ros2_package.sh
Created February 19, 2022 09:52
Create and run ROS2 Galactic example package (Ubuntu)
cd
apt update && apt upgrade -y && apt install wget
ros2 pkg create --build-type ament_python py_pubsub
wget https://raw.githubusercontent.com/ros2/examples/master/rclpy/topics/minimal_publisher/examples_rclpy_minimal_publisher/publisher_member_function.py -P ~/py_pubsub/py_pubsub
wget https://raw.githubusercontent.com/ros2/examples/master/rclpy/topics/minimal_subscriber/examples_rclpy_minimal_subscriber/subscriber_member_function.py -P ~/py_pubsub/py_pubsub
sed -i '23 i \\t\t"talker = py_pubsub.publisher_member_function:main",\n\t\t"listener = py_pubsub.subscriber_member_function:main"' ~/py_pubsub/setup.py
rosdep install -i --from-path ~ --rosdistro galactic -y
colcon build --packages-select py_pubsub
. install/setup.bash
ros2 run py_pubsub talker &