Skip to content

Instantly share code, notes, and snippets.

View lastralla's full-sized avatar

Anthony Bucci lastralla

  • LaSalle, Quebec
View GitHub Profile
@lastralla
lastralla / nespresso_expert_hack.md
Created April 5, 2019 19:56 — forked from farminf/nespresso_expert_hack.md
Hacking Nespresso Expert Machine to brew coffee using custom applications via bluetooth

Nespresso Expert machine Hack (Bluetooth)

Nespresso Expert machine has the Bluetooth ability which officially can be used only by Nespresso mobile app and it does not offer any API for 3rd party applications and services. Moreover, the Bluetooth services and characteristics are not documented and easy to use by the other Bluetooth libraries plus there is no documentation for the Bluetooth packets payload that need to be sent or received.

However, after searching a lot and sniffing the packets for a couple of days, I've been able to hack the machine and write the small nodejs application using noble and express to control and monitor the machine with Rest API exposed by express through Bluetooth connection. As I did this application for my ex-company and they are still using it for their demo I cannot share the code but I'm going to explain how it works.

_Thanks to this

@lastralla
lastralla / countCSSRules.js
Created November 4, 2016 17:51 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@lastralla
lastralla / AngularJS watches counter
Last active August 29, 2015 14:07
Count number of AngularJS watches on page
// Run this is in the console to count how many watches are on a page
// http://stackoverflow.com/questions/18499909/how-to-count-total-number-of-watches-on-a-page
(function () {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) {
watchers.push(watcher);
});
#!/bin/sh
# Written by Mike Ensor ([email protected])
# Copywrite 2012
# Use as needed, modify, have fun!
# This is intended to be used for Maven3 + Mac OSX
#
# To use:
# in your ".bashrc" or ".bash_profile" add the following line:
# source ~/<path to script>/colorize-maven.sh
@lastralla
lastralla / pom.xml
Created February 24, 2014 22:33 — forked from elvanja/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.acme.test</groupId>
<artifactId>nodejs-dependency</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>nodejs-dependency</name>
<description>NodeJS Dependency Project - to be references in nodejs-test</description>
<packaging>jar</packaging>
<!--
Options to share Require.js configuration
https://github.com/jrburke/requirejs/issues/354#issuecomment-6631063
-->
<!-- Inline config -->
<script>
// you can register settings like this before require.js is loaded
var require = {
baseUrl : 'js'
#!/bin/bash
function create_dir {
if [ ! -d $1 ];
then
mkdir $1
fi
}
echo "create the src directory..."
@lastralla
lastralla / Emergency replacement function for $.browser
Created July 11, 2013 02:02
Replacement function for $.browser which was removed in JQuery 1.9. Should only be used to patch old code that makes calls to $.browser.
/* Ol' skool browser detection from JQuery < v1.9. Pulled from old verion of JQuery.
* Should not be used. Only use it to patch old code that relies on calls to $.browser.
* Replace calls to $.browser with this instead.
*
* https://github.com/jquery/jquery/blob/1.8-stable/src/deprecated.js
*/
function getBrowser() {
var matched, browser;
var uaMatch = function( ua ) {