Skip to content

Instantly share code, notes, and snippets.

View marciogranzotto's full-sized avatar

Marcio Granzotto Rodrigues marciogranzotto

View GitHub Profile
tell application "System Events" to delay 3.0
-- tell application "System Events" to set currentApp to name of first process where frontmost is true
if application "Spotify" is running then
-- Create a random number to do one of three things
set randomNum to random number from 1 to 3
if randomNum is 1 then
tell application "Spotify" to pause
// From
import UIKit
extension String {
init(htmlEncodedString: String) {
guard let encodedData = .utf8) else {
marciogranzotto /
Created January 27, 2017 14:01
Zeroconf example
#!/usr/bin/env python
""" Example of announcing a service (in this case, a fake HTTP server) """
import logging
import socket
import sys
from time import sleep
from zeroconf import ServiceInfo, Zeroconf
set voiceList to {"Agnes", "Kathy", "Princess", "Vicki", "Victoria", "Bruce", "Fred", "Junior", "Ralph", "Albert", "Bad News", "Bahh", "Bells", "Boing", "Bubbles", "Cellos", "Deranged", "Good News", "Hysterical", "Pipe Organ", "Trinoids", "Whisper", "Zarvox"}
repeat with voice in voiceList
tell application "System Events" to delay 3.0
tell application "Finder" to say "Clarice!" using voice
end repeat
end repeat
marciogranzotto / KotlinContracts.kt
Last active August 7, 2017 04:01
File template for Android Studio that creates the contracts for a new VIPER module
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
object ${NAME} {
interface View: BaseContracts.View {
class LoginContracts {
interface View {
fun showError(message: String)
//fun presentHomeScreen(user: User) <- This is no longer a part of the View's responsibilities
interface Router {
fun presentHomeScreen(user: User) // Now the router handles it
marciogranzotto /
Last active April 30, 2018 06:53 — forked from fragolinux/
simple but effective node-red setup backup script
# useful vars
DATE=$(date +"%Y%m%d%H%M")
# create dated backup folders
mkdir -p $WHERE/{sqlite,nodered,etc}
# safely backup sqlite db
# sqlite3 ~/dbs/iot.db ".backup $WHERE/sqlite/iot.db"
# backup json and js files


This is the english version

Para a versão em português (pr-BR) use ESSE LINK

Recently, some smart plugs with the BR plug type started appearing on AliExpress

devicename: nome_do_nodo
ss_id: "Nome da Wifi"
pass: "Senha da Wifi"
switch4: "Nome switch4"
light_1: "Nome Luz1"
light_2: "Nome Luz2"
light_3: "Nome Luz3"
name: ${devicename}
marciogranzotto / MVP + Interactor example.kt
Last active November 4, 2020 15:40
This is an example of Android development with MVP + Interactor in Kotlin
interface LoginContracts {
interface View {
fun presentHomeScreen(user: User)
fun showError(message: String)
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)