Skip to content

Instantly share code, notes, and snippets.

View reduardo7's full-sized avatar
💭
🤔

Eduardo Daniel Cuomo reduardo7

💭
🤔
View GitHub Profile
@reduardo7
reduardo7 / output_prefix.sh
Last active April 29, 2023 20:56
Output prefix with timestamp
#!/usr/bin/env bash
{
echo foo 1
sleep 1
echo bar 1 >&2
echo foo 2
sleep 1
echo bar 2 >&2
} \
@reduardo7
reduardo7 / log_prefix.sh
Last active April 29, 2023 13:22
Bash output prefix and redirect to a file with timestamp
#!/usr/bin/env bash
[ -f test.log ] && rm -f test.log
{
{
echo foo 1
sleep 1
echo bar 1 >&2
echo foo 2
@reduardo7
reduardo7 / README.md
Last active January 10, 2022 20:28
DB with Revision History
@reduardo7
reduardo7 / README.md
Last active January 10, 2022 17:29
DB with Revision History

DB with Revision History

First, you have only one table to handle everything, in order to keep the model design and the data integrity at only one point.

This is the basic idea, you can extend the design with the created_by & updated_by columns if you need.

The following implementation is for MySQL, but the idea can be implemented at other kind of SQL databases too.

Cons

@reduardo7
reduardo7 / gdrive-upload.sh
Last active March 4, 2024 09:15
Upload to Google Drive.
#!/usr/bin/env bash
# https://towardsdatascience.com/uploading-files-to-google-drive-directly-from-the-terminal-using-curl-2b89db28bb06
# Require "curl"
# $ sudo apt install curl # Linux Debian/Ubuntu
# $ brew install curl # Mac
_err() {
echo >&2 "Error! $*"
@reduardo7
reduardo7 / meet-mute.js
Last active July 1, 2021 12:34
Google Meet mute/unmute with media keys
if(window.__meetMutePlay__){console.warn('Already loaded!');}else{(function(){
const log = (...args) => console.info('Mute-Play:', ...args);
if (!('mediaSession' in navigator)) { log('The Media Session API is not yet available. Try Chrome for Android.'); return; }
const muteBtn = document.querySelector('[data-is-muted] > div');
if (!muteBtn) { log('Mute button not found!'); return; }
navigator.mediaSession = navigator.mediaSession || {};
@reduardo7
reduardo7 / index.html
Created November 24, 2020 22:11
Patagonian | IUPA | DOM HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> -->
<title>Listado de Items para jugar con el DOM</title>
@reduardo7
reduardo7 / arrayGetByPath.php
Created November 11, 2020 17:39
PHP - Get object/array value by path.
<?php
/**
* Get array value by path.
*
* @param string|array $path Array Path.
* @param mixed $data Data where search.
* @param mixed|null $default Default value on path not found.
* @return mixed|null Value.
* @see https://stackoverflow.com/a/27930028/717267
@reduardo7
reduardo7 / README.md
Created May 29, 2019 14:20
Userscripts for Greasemonkey/Tampermonkey

Userscripts for Greasemonkey/Tampermonkey

@reduardo7
reduardo7 / kubernetes-connect-mongo.sh
Last active March 6, 2019 18:18
Kubernetes: Connect to Mongo POD + port-forward
#!/usr/bin/env bash
# https://gist.github.com/reduardo7/00928a0a50bf51f7c9ba218e95eb37c3
################# Connect to Mongo DB #################
# Params:
# - Environment: uat/prod
# - POD Name: Optional. Specific POD.
#
# Examples: