Skip to content

Instantly share code, notes, and snippets.

View sergiocasero's full-sized avatar

Sergio Casero Hernández sergiocasero

View GitHub Profile
sergiocasero / good_morning.yaml
Last active January 23, 2023 14:34
Good morning Home Asssistant
description: ""
- platform: time
at: "08:00:00"
condition: []
- service: notify.telegram
message: >
{# Change these entities with your's #}
stage: test
- ./gradlew test jacocoTestReport
- docker-L
- shared/build/reports/jacoco.xml
sergiocasero / crontab
Last active September 29, 2022 11:15
A simple, lightweight but powerfull telegram bot that sends your public IP through telegram in case it changes, really useful if you have dynamic IPs but also have a private cloud
# Every minute, perfect for IP_INFO free tier
* * * * * /usr/bin/python3 /PATH_TO_THE_SCRIPT/
for d in */ ; do
cd $d
if [ -f "pubspec.yaml" ]; then
echo "$d is a flutter project"
flutter clean
echo "$d is a gradle project"
./gradlew clean
sergiocasero / build.gradle.kts
Last active March 30, 2021 08:13
Add common code to sonarqube analysis
buildscript {
repositories {
// repos
dependencies {
// deps
plugins {
sergiocasero /
Created February 3, 2021 07:42
This is a quite simple script that cleans all your grade/flutter projects inside a folder

Works on linux and macOS (and linux inside Windows)

  1. Download the script (or copy paste it)
  2. Put the script in the same folder than your projects
  3. chmod +x, if you didn't change the name => `chmod +x
  4. ./
  5. Wait and enjoy!!

If you find this gist helpful, don't forget the star! :)

sergiocasero /
Created February 1, 2021 20:26
This is a simple and small script to automatize the raspberry pi pico micropython SDK compilation
mkdir pico_micropython_install
cd pico_micropython_install
git clone -b pico
cd micropython
git submodule update --init -- lib/pico-sdk
cd lib/pico-sdk
git submodule update --init
cd ../..
make -C mpy-cross
cd ports/rp2
package com.sergiocasero.backend.push
import com.sergiocasero.model.PushTopic
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.runBlocking
import okhttp3.ResponseBody
import retrofit2.http.Body
sergiocasero / ssl_pinning_android_ktor.kt
Last active September 22, 2020 16:09
Simple snippet that demonstrates how to make https request with SSL pinning by using ktor on Android
class AndroidRemote(private val context: Context) : Remote {
companion object {
private const val SSL_PROTOCOL = "TLSv1.2"
private const val KEYSTORE_PROTOCOL = "BKS"
private const val KEY_MANAGER_ALG = "X509"
private const val KEYSTORE_PATH = "YOUR_ASSET_NAME.bks"
private val KEYSTORE_PASSWORD = "YOUR_PASS".toCharArray() // Find better place to store this please hahaha
private const val API_ENDPOINT = "API_ENDPOINT"
sergiocasero / main.dart
Created July 31, 2020 11:36
Custom Sliver with Toolbar Ellipsis behind
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
class MyApp extends StatelessWidget {