Skip to content

Instantly share code, notes, and snippets.

View julianpitt's full-sized avatar

Julian Pittas julianpitt

  • Melbourne, Australia
View GitHub Profile
@julianpitt
julianpitt / secondsHelpers.js
Last active February 12, 2020 03:33
[Data transforms]
function pad(toPad, padBy = 2, padWith = '0') {
return ('' + toPad).length < padBy ? `${pad(padWith + toPad, padBy, padWith)}` : toPad;
}
function secondsToHMS(totalSeconds) {
var hours = totalSeconds / 3600 - totalSeconds % 3600 / 3600;
var minutes = ((totalSeconds % 3600 / 3600) * 60) - ((totalSeconds % 3600 / 3600) * 60) % 1;
var seconds = totalSeconds % 60;
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
}
@julianpitt
julianpitt / make file targets.bash
Created October 8, 2019 05:03
List all Makefile targets on Mac and sort #bash
make -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }' | sort
@julianpitt
julianpitt / launch.json
Last active March 3, 2023 23:18
[vscode debugging for serverless framework with webpack and serverless invoke] Use VSCode to debug your serverless framework functions when using the serverless-webpack plugin and want to use the `sls invoke local` command #Serverless #AWS #Webpack #Javascript #Typescript
{
"version": "0.2.0",
"inputs": [
{
"id": "echoPrompt",
"description": "Please enter a function name to test",
"default": "myFunction",
"type": "promptString"
}
],
@julianpitt
julianpitt / takeownership.sh
Last active July 10, 2019 00:05
[Take ownership quick action in mac] #automation
# Create a Take Ownership button in the mac right click menu in Finder under "Quick Actions"
# To create the automator script
# Open Automator by going to Finder -> Applications -> Automator.app
# Click "New Document"
# Select "Quick Action" then click "Choose"
# In the right panel make sure the following is selected:
@julianpitt
julianpitt / getAWSServiceRegions.js
Created May 4, 2019 03:47
[Get AWS Service Regions]Get a list of supported aws regions for a particular service #aws #javascript
const AWS = require('aws-sdk');
const ssm = new AWS.SSM();
function getRegionFromServiceRegionResponse(ServiceRegionResponse) {
return ServiceRegionResponse.Parameters
.map((serviceRegion => serviceRegion.Value));
}
function getServiceRegions(serviceName) {
let params = {
'use strict';
/**
* Created by Peter Sbarski
* Updated by Mike Chambers
* Updated by Julian Pittas
* Last Updated: 27/02/2018
*
* Required Env consts:
* AUTH0_DOMAIN