Skip to content

Instantly share code, notes, and snippets.

@martin-garbe
martin-garbe / cloudformation-ipv6-address-via-custom-resource
Created September 5, 2022 11:12
Fetch IPv6 address of EC2 instance for creating AAAA DNS record
# large parts taken from https://aws.amazon.com/blogs/mt/four-ways-to-retrieve-any-aws-service-property-using-aws-cloudformation-part-1/
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ExampleServiceInstanceName:
Default: Example
Description: Instance and Host Name
Type: String
Resources:
ExampleService:
Properties:
@tennantje
tennantje / convert_olm_to_eml.py
Last active December 21, 2023 18:21
Convert Outlook for Mac (OLM) to EML files as PST conversion tools are expensive
# MIT LICENSE
# Copyright 2021 Jeremy Tennant
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA

Cheat sheet: JavaScript Array methods

Deriving a new Array from an existing Array:

['■','●','▲'].slice(1, 3)           ['●','▲']
['■','●','■'].filter(x => x==='■')  ['■','■']
    ['▲','●'].map(x => x+x)         ['▲▲','●●']
    ['▲','●'].flatMap(x => [x,x])   ['▲','▲','●','●']
@jasnell
jasnell / index.js
Created May 24, 2021 21:58
Getting loopy with JavaScript
'use strict';
const {
createHistogram,
performance: {
timerify
}
} = require('perf_hooks');
const users = [
@vi
vi / split_by_silence.sh
Last active February 23, 2024 13:18
Using FFmpeg to split multimedia file into parts based on audio volume level
#!/bin/bash
IN=$1
OUT=$2
true ${SD_PARAMS:="-55dB:d=0.3"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
@fnky
fnky / ANSI.md
Last active May 22, 2024 08:06
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@xxlukas42
xxlukas42 / moisture.ino
Created July 16, 2018 18:58
Capacitive soil moisture sensor
#include <SPI.h>
#include <Wire.h>
#include <SFE_MicroOLED.h>
#define PIN_RESET 255
#define DC_JUMPER 0
int i;
int moi = 0;
@JacobJohansen
JacobJohansen / AuthyToOtherAuthenticator.md
Created October 20, 2017 15:12 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@xmlking
xmlking / README.md
Last active September 21, 2015 21:50
Amazon Dash Button triggering Auth0's `webtask` to send text message when button is pressed.

Node-Dash-Button-Webtasks

Simple demo showcasing IoT and Auto0's Webtask integration.

npm install wt-cli -g

wt create send_text.js --name send_text -s TWILIO_ACCOUNT_SID=aaaa -s TWILIO_AUTH_TOKEN=aaa -s TWILIO_NUMBER=+15005550006
@ajfisher
ajfisher / 0x00000.bin
Last active October 10, 2021 00:51
ESP8266 Transparent bridge to J5