Skip to content

Instantly share code, notes, and snippets.

View rock3r's full-sized avatar

Sebastiano Poggi rock3r

View GitHub Profile
@rock3r
rock3r / .gitignore
Last active April 13, 2024 12:52
A template .gitignore for Kotlin projects using Gradle (with additional content for Android projects)
## Seb's .gitignore template
# You can find the most up-to-date version at https://go.sebastiano.dev/gitignore
# Partly based on templates by https://plugins.jetbrains.com/plugin/7495--ignore
# Released under a CC-0 License https://creativecommons.org/share-your-work/public-domain/cc0/
### Windows template
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
@rock3r
rock3r / highlights.md
Created February 6, 2024 11:05
Malformed highlight blocks tests
@rock3r
rock3r / README.md
Last active January 27, 2024 14:51
A simple bash script to enable demo mode on a Marshmallow+ device via ADB (based on http://bit.ly/295BHLx)

Usage

$ demo on|off [hhmm]

Enable or disable the demo mode on a connected Android device or emulator. You can also pass in a custom value for the system clock in the HHMM format (only used when you use the on command).

⚠️ This script only works on *nix systems and has only been tested on macOS with Bash (but should be portable).

@rock3r
rock3r / DrawText.kt
Created August 20, 2023 10:38
Draw text on a bitmap
@OptIn(ExperimentalAnimationApi::class)
@Composable
private fun DrawText(it: PaddingValues) {
Column(Modifier.padding(it)) {
var text by remember { mutableStateOf("Vel eum voluptatem nulla. Ut enim unde sit autem laboriosam consequatur ut. Quo eius veniam occaecati minima. Porro architecto et omnis. Et dolor qui non. Tempora et consequuntur ea quia iste qui ducimus cum.\n") }
OutlinedTextField(value = text, onValueChange = { text = it.trim() })
val baseFontSizePx = with(LocalDensity.current) { 24.sp.toPx() }
val context = LocalContext.current
var bitmap by remember { mutableStateOf<ImageBitmap?>(null) }
@rock3r
rock3r / hvac_toggle.yaml
Created August 6, 2023 11:33
Home Assistant blueprint to turn a HVAC on or off based on a binary sensor
blueprint:
name: HVAC automation
source_url: https://gist.github.com/rock3r/5954b87184c6536bb8f2ea922bc97f02
description: Turn a HVAC on or off based on a binary sensor
domain: automation
input:
opening_sensor:
name: Window/Door sensor
description: The window or door sensor to use to drive the Tado valve
selector:
@rock3r
rock3r / svg2icns.sh
Created July 17, 2023 16:43
A macOS Bash script to generate an icns file (macOS app icons) from an svg file
#! /bin/bash
#----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Seb
# ----------------------------------------------------------------------------
# Inspired by http://www.spaziocurvo.com/2015/03/svg-to-icns-script-for-mac-os-x/
# and https://gist.github.com/plroebuck/af19a26c908838c7f9e363c571199deb
@rock3r
rock3r / LoadResource.kt
Created July 7, 2023 13:46
JVM (Desktop) resource loading, for resources living in a different classloader
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Sebastiano Poggi wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Seb
* ----------------------------------------------------------------------------
*/
/**
@rock3r
rock3r / EqualWidthComponentsRow.kt
Last active July 5, 2023 14:40
Compose Custom Layout: row of components, all made as wide as the widest one
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Sebastiano Poggi wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Seb
* ----------------------------------------------------------------------------
*/
package dev.sebastiano.bundel
@rock3r
rock3r / gw-update.sh
Last active June 30, 2023 01:27
Simple script to update Gradle from the command line (*NIX)
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy us a beer in return.
#### SETUP/USAGE INSTRUCTIONS ####
@rock3r
rock3r / privacy-policy.md
Created June 14, 2023 18:23
Weeeeeee privacy policy

Weeeeee(th the Italians) privacy policy

We don't collect any user data, period.