Skip to content

Instantly share code, notes, and snippets.


Sergio Casero Hernández sergiocasero

View GitHub Profile
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 Mar 30, 2021
Add common code to sonarqube analysis
View build.gradle.kts
buildscript {
repositories {
// repos
dependencies {
// deps
plugins {
sergiocasero /
Created Feb 3, 2021
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 Feb 1, 2021
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
View KotlinPush.kt
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 Sep 22, 2020
Simple snippet that demonstrates how to make https request with SSL pinning by using ktor on Android
View ssl_pinning_android_ktor.kt
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 Jul 31, 2020
Custom Sliver with Toolbar Ellipsis behind
View main.dart
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
class MyApp extends StatelessWidget {
sergiocasero /
Last active Apr 13, 2020
Firebase wrapper for iOS and Android with kotlin multiplatform

Hello guys, I've raised into that problem for a days, but i think I've found one solution, maybe this isn't the better way to do that, but... I will share it. (This is inspired in the Firebase multiplatform repo ->, I'm just summarizing that)

If you want to call some code from a DataSource or Repository from your common code, and the libraries you're using use callbacks, you need to wrap them and there are some problems:

Let me explain it with an example:

expect class RemoteDataSource() {
sergiocasero / DaoGenerator.kt
Created Apr 25, 2019
DaoGenerator code template for IntelliJ/AS
View DaoGenerator.kt
package ${PACKAGE_NAME}
sergiocasero / functions.js
Created Jan 12, 2019
Switch Google Assistant
View functions.js
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const admin = require('firebase-admin');
const db = admin.database();
const ref = db.ref("/switch");