Skip to content

Instantly share code, notes, and snippets.

View edudobay's full-sized avatar

Eduardo Dobay edudobay

View GitHub Profile
@edudobay
edudobay / money.rb
Last active March 17, 2024 15:05
Example Money/Currency classes in Ruby 3.x
require 'bigdecimal'
class CurrencyMismatch < RuntimeError
end
class Currency
def initialize(symbol, decimals)
@symbol = symbol
@decimals = decimals
end
@edudobay
edudobay / google_groups_batch_download.md
Last active March 13, 2023 15:01
Batch download Google Groups attachments

A previous known tool to batch download Google Groups messages, https://github.com/icy/google-group-crawler, does not work with the current (as of March 2023) Google Groups website.

What I needed was to download all attachments from a small number of conversations. So I used some JavaScript to automate downloading them from my browser. It works like this:

  • Open the Google Groups app and insert the initialization code into the Console:
function sleep(ms) {
  return new Promise(r => setTimeout(r, ms))
}
@edudobay
edudobay / Instant-Dark-Mode.js
Last active April 9, 2021 17:29
Instant dark mode (bookmarklet)
// Thanks to https://twitter.com/derekstavis/status/1306021971163926528 !
// Install this as a bookmarklet, use a tool like https://caiorss.github.io/bookmarklet-maker/
const styleId = 'Instant-Dark-Mode'
const THEME = 'Instant-Dark-Mode'
const THEME_DARK = `${THEME}--dark`
const THEME_LIGHT = `${THEME}--light`
let element = document.getElementById(styleId)
if (!element) {
@edudobay
edudobay / GitLab-Embed-GoogleDocs.userscript.js
Last active December 15, 2020 14:49
Embed Google Docs into GitLab (user script)
// ==UserScript==
// @name Embed Google Docs into GitLab
// @namespace http://github.com/edudobay/
// @website https://gist.github.com/edudobay/8cea2e2f2e670a0f24d5cd50c0133834
// @updateURL https://gist.github.com/edudobay/8cea2e2f2e670a0f24d5cd50c0133834/raw/GitLab-Embed-GoogleDocs.userscript.js
// @downloadURL https://gist.github.com/edudobay/8cea2e2f2e670a0f24d5cd50c0133834/raw/GitLab-Embed-GoogleDocs.userscript.js
// @version 0.2
// @description The name says it all.
// @author https://github.com/edudobay
// @match https://gitlab.com/*
@edudobay
edudobay / manual_WhatSpeed.md
Last active April 17, 2021 13:46
Alterar (aumentar ou diminuir) a velocidade do áudio/vídeo no WhatsApp Web ou outros sites

WhatSpeed? Versão atual: 2

  • Versão 2: também funciona para qualquer outro site que tenha áudios ou vídeos!
  • Versão 1: versão inicial (apenas WhatsApp Web)

🚧🚧🚧 Não funcionando para WhatsApp Web - 08.04.2021 🚧🚧🚧

Parece que o WhatsApp Web foi atualizado de maneira que esta ferramenta não funciona mais com ele. Vou postando atualizações à medida que souber.

Alterar (aumentar ou diminuir) a velocidade do áudio no WhatsApp Web

@edudobay
edudobay / composer.json
Created June 12, 2019 00:36
Demonstrate namespace shadowing by PsySH
{
"name": "example/psysh-imports-shadow-namespaces",
"require": {
"nesbot/carbon": "^2.19",
"psy/psysh": "^0.9.9"
}
}
@edudobay
edudobay / gitlab
Created May 10, 2019 16:25
Script to open GitLab project URLs in your browser
#!/usr/bin/env python3
import argparse
import sys
import subprocess
import re
import urllib.parse
def git(args):
proc = subprocess.run(
@edudobay
edudobay / FlowableClock.kt
Last active October 19, 2018 00:24
Flowable Clock: a Clock that switches its behavior whenever a new item is emitted by a given Flowable
import io.reactivex.Flowable
import io.reactivex.disposables.Disposable
import org.threeten.bp.Clock
import org.threeten.bp.Instant
import org.threeten.bp.ZoneId
import kotlin.properties.Delegates
/**
* A [Clock] that acts as the latest clock emitted so far by the given Flowable.
*
@edudobay
edudobay / git-allrepos
Last active May 7, 2019 17:19
Script to sync (fetch) all git repos within a directory
#!/usr/bin/env python3
from argparse import ArgumentParser, Namespace
import os
import subprocess
def is_git_repo(entry):
from os.path import join, isdir
return isdir(entry) and isdir(join(entry, '.git'))