Skip to content

Instantly share code, notes, and snippets.

View mcomisso's full-sized avatar

Matteo Comisso mcomisso

View GitHub Profile
@mcomisso
mcomisso / ESP+mqtt.ino
Created February 11, 2019 00:46
ESP+OneWire temperature
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <PubSubClient.h>
#include <DallasTemperature.h>
const char* ssid = "SSID";
const char* password = "PASSWORD";
const char* mqtt_server = "X.X.X.X";
#define ONE_WIRE_BUS 2
@mcomisso
mcomisso / dotenv.swift
Created October 8, 2018 01:41
Initial dotenv, playground
import UIKit
enum ParserError: Error {
case missingKey
case genericError
}
struct Value: Hashable, Equatable {
let innerValue: String
/// Both objects will have a shared set of features to be used in the generic function
protocol HasSomeSharedFeatures {
func performSharedThing()
}
/// Extends the base class with some shared features
class PFObject: NSObject, HasSomeSharedFeatures {
func performSharedThing() { }
}
import json
import random
import pandas as pd
import sys
sys.setrecursionlimit(1500)
class Person:
def __eq__(self, other):
@mcomisso
mcomisso / SwiftCellProtocol.swift
Last active April 14, 2017 13:08
A protocol that enables wiggle-wiggle motion to UICollectionViewCells
//MARK:- UICollectionViewCells
import Material
public protocol CellEditable {
func deleteElement()
func startBeingAfraid()
func stopBeingAfraid()
}
@mcomisso
mcomisso / PassKit.json
Created July 5, 2016 23:46
PassKit example, iBeacon powered
{
"formatVersion": 1,
"passTypeIdentifier": "pass.reverse.dns",
"serialNumber": " *call uuidgen* ",
"logoText": "Matteo Comisso",
"teamIdentifier": " *redacted* ",
"organizationName": "Matteo Comisso",
"description": "Matteo Comisso",
"labelColor": "rgb(206, 215, 219)",
"foregroundColor": "rgb(255, 255, 255)",

Keybase proof

I hereby claim:

  • I am mcomisso on github.
  • I am mcomisso (https://keybase.io/mcomisso) on keybase.
  • I have a public key ASDMPO7a4vYogrBNWronP7vNqi-Slp4uIEwI-hcSuoYmgAo

To claim this, I am signing this object:

@mcomisso
mcomisso / nginx_deps.sh
Last active April 11, 2016 10:46
Nginx dependencies
#!/bin/bash
# !!!
# chmod +sx this script (sudo + exec)
#
if [ "$(id -u)" != "0" ]; then
echo "Run this script with sudo or as root" 1>&2
exit 1
fi
# Install libraries
@mcomisso
mcomisso / force_git_pull_all.sh
Created March 13, 2016 22:34
FORCE update all the git projects inside the current directory
#!/bin/zsh
for dir in */; do cd $dir; git clean -df; git reset --hard; git pull; cd ..; done
@mcomisso
mcomisso / Dyn.py
Created March 13, 2016 22:31
Example of classes with dynamically selectors in python
class Http_Server(object):
environment = {}
def __init__(self, env):
self.environment = env
print self.environment
# Dynamically fetch the environments variables for the operating system
self.os = getattr(__import__('enheritage'), self.environment.get('os', 'Debian'))
def reload(self):