Skip to content

Instantly share code, notes, and snippets.

@dimaj
dimaj / NOZZLE_WIPE Macro.md
Last active February 28, 2025 06:39
Flashforge AD5m \ pro nozzle wipe macro

This is a macro for Flashforge Adventurer 5M (Pro) to wipe the nozzle before prints. This macro implies that you are using Tinkering Poko's model, which could be found on Printables

You should double check that the default values match up with your installation (or, you can pass in all parameters to the macro)

@dimaj
dimaj / README.md
Last active August 6, 2024 17:31
A small script that will attempt to parse transaction notification email and push it over to YNAB and

For this method to work, you need to:

  • Configure alerts from your banks to be sent to you via an email
  • Configure your Gmail with filters that will flag all of your alerts emails with a ynab-to-process label
  • Create a new google scripts project (https://script.google.com) with contents of this gist (make sure that you update all references to ynab-<bank>-account-id to your actual account ids as found in ynab)
  • Setup a trigger to run every however often you want it to run (I have mine every 10 minutes)

If you have more banks, simply add more entries to the accountsMap object and update regexes to match.

@dimaj
dimaj / README.md
Created May 24, 2022 16:16
The Spaghetti Detective in Docker

In order to run TSD in docker, do the following:

  • Create a data folder on your Docker Host to store TSD's data
mkdir -p /home/docker/tsd/{web,tasks}
  • Create empty files for databases (otherwise, every time you re-initialize the stack, you'll loose all your config)
touch /home/docker/tsd/{web,tasks}
  • Launch the stack: docker compose up -d
@dimaj
dimaj / instructions.md
Created May 4, 2022 17:08
YNAB Investment tracking

You'll need to following to get up and running:

  • Get YNAB Personal Access Token: https://app.youneedabudget.com/settings/developer
  • Setup Google Apps project: https://script.google.com/home
  • In the project properties, add the following properties:
    • ynabToken - Token from the first step
    • ynabStocksAccountName - Name of the tracking account with your investments
    • ynabStocksBudgetName - Name of the budget with your investment account
  • Add a note to your investment account with your account holding in a form of: INVESTMENTS: TICKER1 SHARE_COUNT, TICKER2 SHARE_COUNT, CASH DOLLAR_AMOUNT. e.g. INVESTMENTS: FXAIX 1000, CASH 452.16
  • Configure trigger in Google Apps Console:
  • Function to run: updateStocksAccount
@dimaj
dimaj / Android YNAB Importer.md
Last active April 27, 2025 20:02
YNAB Android Transaction Auto-Import

This is a small Tasker script on how to automatically import your non-cash transactions into YNAB.

This requires several pre-requisites:

  1. You need to login to your financial institutions and enable SMS notifications for all transactions.
  2. You need to have Tasker installed on your phone from Google Play Store

Setup

After you have enabled transaction notifications and installed Tasker, time to create your profile.

  1. Using a text editor on your computer, compile your task configuration:
  2. Extract your budget id by following steps below
@dimaj
dimaj / wipes_gloves.scad
Last active January 5, 2021 17:55
OpenSCAD file for generating Gloves and Wipes holders
/* [Box Params] */
// Box height (mm)
height = 100;
// Distance between the edge and cutout (mm)
padding = 5;
/* [Print Selection] */
// Please select item to print
item_to_print = "Wipes"; // ["Wipes", "Gloves", "Connectors", "Connector Caps", "Labels"]
@dimaj
dimaj / Flashing Tasmota on Sonoff.md
Created June 22, 2019 18:03
Fixing flashing issues on a mac

Fiing `` issue while flashing

When I was trying to flash Tasmota fw onto my sonoff dual r2, I would always get an error and flashing would error out after 10 seconds.

Error that I got was:

warning: espcomm_send_command: didn't receive command response
An error occurred while uploading the sketch
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
warning: espcomm_send_command: wrong direction/command: 0x01 0x03, expected 0x01 0x04
error: espcomm_upload_mem failed
@dimaj
dimaj / debug_mocha_webpack.md
Last active January 17, 2019 02:48
How to analyze stack traces produced by mocha-webpack

If you are trying to run your mocha tests by using mocha-webpack, you might end up with an ugly stack trace that points to some line number in a temporary file, which was created by mocha-webpack module. Unfortunately, when test execution completes, that temporary file is long gone and you are left with a big puzzle to solve.

Here's how you can generate that bundle.js file that is referenced in the stack trace:

export PATH="$PATH:`pwd`/node_modules/.bin"
webpack --config webpack.config.test.js test/**/*.spec.ts saved.bundle.js
mocha-webpack --webpack-config webpack.config.test.js test/**/*.spec.ts 

Now, when you get a stack trace, simply look at your saved.bundle.js and see what is going on!

/**
* A utility method to log an error and then throw an exception
* @param msg Message to log
* @param ex An exception to throw
* @throws RuntimeException with the exception that has been passed in
*/
private def puke(msg: String, ex: Throwable = null) = {
if (ex == null) {
logger.error(msg)
} else {
@dimaj
dimaj / es_backup.sh
Created January 30, 2017 05:28
Backup elasticsearch
#!/bin/bash
set -e
HOST="CHANGE ME TO POINT TO YOUR ES LOCATION"
BACK_DISK="CHANGE ME TO POINT TO FINAL DESTINATION OF BACKUP"
DEST="${BACK_DISK}/ram"
RAMDISK_SIZE="3g" # 3 Gb
OLDIFS="${IFS}"
IFS=$'\n'