Skip to content

Instantly share code, notes, and snippets.

View pedrostc's full-sized avatar

Pedro Osternack Correa pedrostc

  • slalom _build
  • Ottawa
View GitHub Profile
@pedrostc
pedrostc / TimeList.js
Created June 11, 2022 13:07
Creates a list of times for every X minutes from a start to an end time
var interval = 30; //minutes interval
var times = []; // time array
var start = 0; // start time
var end = 24; // start time
var meridiem = ['AM', 'PM']; // AM-PM
function formatHour(hour) {
return [0, 12].includes(hour) ? 12 : ("0" + (hour % 12)).slice(-2);
}
@pedrostc
pedrostc / cookieMonitor.bookmarklet.js
Last active April 1, 2022 22:22
Bookmarklet to monitor the cookies of a given page
javascript: ((() => {let s=new Map();let a=(n,v)=>{console.groupCollapsed(`%c new cookie added - ${n}`,"color:green");console.info(`name: ${n}`);console.info(`value: ${v}`);console.groupEnd();s.set(n,v);};let u=(n,v)=>{console.groupCollapsed(`%c cookie updated - ${n}`,"color:blue");console.info(`name: ${n}`);console.info(`old value: ${s.get(n)}`);console.info(`new value: ${v}`);console.groupEnd();s.set(n, v);};let r=(n)=>{console.groupCollapsed(`%c cookie removed - ${n}`,"color:red");console.info(`name: ${n}`);console.info(`old value: ${s.get(n)}`);console.groupEnd();s.delete(n);};var __cookieWatch=setInterval(()=>{let c=document.cookie.split(';').map((cur)=>{const [n,v]=cur.trim().split('=');return {n,v};});c.forEach(({n,v})=>{if(!s.has(n)){a(n, v);}else if(s.get(n)!==v){u(n, v);}});for(const k of s.keys()){if(!c.some(({n})=>n===k)){r(k);}}},300);})())
@pedrostc
pedrostc / installOnAllNodeVersions.ps1
Created November 30, 2021 16:49
Installs a given package name on all Node versions installed through NVM
<#
.SYNOPSIS
Installs a given package name on all Node versions installed through NVM
.DESCRIPTION
Lists all available node versions, switches to each one and installs the informed package globably.
.PARAMETER packageName
The package to be installed
@pedrostc
pedrostc / ExportReposPathVariables.ps1
Last active November 30, 2021 15:32
Small script that will programmatically add variables to the pwsh session for each item on the map. Useful to facilitate navigating between folder without needing to type the full path.
$baseReposPath = 'C:\src'
$repoMap = @{
fe = 'front-end';
be = 'back-end';
scripts = 'devops/scripts'
}
$repoMap.keys.ForEach({ New-Variable -Name $_ -Value (Join-Path $baseReposPath $repoMap[$_]) })
@pedrostc
pedrostc / ToggleJiraSideBar.js
Last active November 12, 2021 19:22
bookmarklet to Toggle the Jira story view right bar
javascript:(() => {var e = document.querySelector('[data-test-id$=".issue-layout.right-most-column"]').parentElement; e.style.display=(e.style.display==='none' ? %27%27 : %27none%27);})()
@pedrostc
pedrostc / Profile.ps1
Created March 10, 2020 19:13
[Git Aliases for powershell] My git aliases for powershell. #git #powershell #posh #pwsh
Function Get-GitConfigUserEmail {
git config --get user.email
}
Set-Alias gitemail Get-GitConfigUserEmail
Function Get-GitLog { git log --oneline --graph --color }
Set-Alias glog Get-GitLog
Function Set-DevelopBranch {
stash
@pedrostc
pedrostc / monaco.html
Created February 4, 2020 15:16
Simple in-browser markdown editor using monaco
data:text/html, <html><head><title>Markdown Editor</title></head><body style="margin:0px;overflow: hidden;"><div id="container" style="width: 100%; height:100%;margin: 0px;border:1px solid grey"></div><script src="https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/loader.js"></script><script type="text/javascript"> %09require.config({ paths: { 'vs': 'https://microsoft.github.io/monaco-editor/node_modules/monaco-editor/min/vs/' }});%09require(['vs/editor/editor.main'], function() {var editor = monaco.editor.create(document.getElementById('container'), {value: '', language: 'markdown'});});</script></body></html>
@pedrostc
pedrostc / WindowsPhotoViewer.reg
Created August 1, 2019 14:22
[Reg keys to enable windows photo viewer]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
"MuiVerb"="@photoviewer.dll,-3043"
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@pedrostc
pedrostc / aws-get-not-terminated.sh
Last active July 24, 2019 15:12
[AWS - Get not terminated instances info] Gets the Name, instanceId, PrivateIP and State Name for the pending and running instances using jq. #aws #jq #ec2
aws ec2 describe-instances --filter Name=instance-state-name,Values=pending,running | jq ".Reservations[] | .Instances[] | { name: (.Tags[] |select(.Key == \"Name\") | .Value ), id:.InstanceId, ip:.PrivateIpAddress, state:.State.Name }"
@pedrostc
pedrostc / benchmark-commands.md
Created July 18, 2019 17:32 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \