Skip to content

Instantly share code, notes, and snippets.

View farminf's full-sized avatar

Farmin farminf

  • Ontario
View GitHub Profile
@farminf
farminf / SeriesCallWithDelay
Created February 17, 2022 13:38
HTTP calls in series with delay between
/**
I wanted to call an endpoint updating an entity and I wanted to do it for 500 entities.
The API server had "rate limit" and I couldn't just use Promise.all
I wrote this script just to call each update and have a 2 second delay between
them to make sure API server would not block them
*/
@farminf
farminf / pr-alert-stack.ts
Created October 4, 2021 20:28
CDK stack for API Gateway and Lambda
import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import * as apigateway from "@aws-cdk/aws-apigateway";
export class PRAlertStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
@farminf
farminf / alert.js
Created October 4, 2021 20:23
Sending PR Alerts Via Slack Using AWS Serverless and AWS CDK
const AWS = require("aws-sdk");
const fetch = require("node-fetch");
const crypto = require("crypto");
const slackChannel = process.env.SLACK_CHANNEL_URL;
const githubSecret = process.env.WEBHOOK_SECRET;
const verifyGitHubSignature = (req = {}, secret = "") => {
const sig = req.headers["X-Hub-Signature"];
const hmac = crypto.createHmac("sha1", secret);
const digest = Buffer.from(
@farminf
farminf / cdkApp.js
Created December 16, 2019 08:25
Deploying different stacks based on different account
/* eslint-disable no-new */
const AWS = require("aws-sdk");
const cdk = require("@aws-cdk/core");
const { CommonStack } = require("./stack");
const { DevStack } = require("./dev-stack");
const { ProdStack } = require("./prod-stack");
const sts = new AWS.STS({});
### Keybase proof
I hereby claim:
* I am farminf on github.
* I am farminf (https://keybase.io/farminf) on keybase.
* I have a public key ASAvOY8T9IGolJm_h2lJgj0zNSQhsGHPIgCyT13mIovdMAo
To claim this, I am signing this object:
@farminf
farminf / nespresso_expert_hack.md
Last active March 16, 2024 19:04
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