Skip to content

Instantly share code, notes, and snippets.

View edudobay's full-sized avatar

Eduardo Dobay edudobay

View GitHub Profile
@edudobay
edudobay / StateMachine.kt
Created January 15, 2018 20:22
RxJava state machine
package example
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.subjects.BehaviorSubject
import java.util.concurrent.TimeUnit
import kotlin.concurrent.thread
enum class InternalState { ON, OFF, GOING_ON, GOING_OFF }
@edudobay
edudobay / git-branch-protection.md
Last active June 27, 2023 13:02
Command-line script for protecting/unprotecting branches in a GitHub repository

(To be improved)

Requirements

  • httpie (which provides the http command) — pip install httpie

Setup

  • Save the git-branch-protection.sh as git-branch-protection somewhere in your path (something like ~/bin or ~/.local/bin if you already use it)
  • Generate a GitHub token and save it as ~/.config/github_token.
@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'))
@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 / 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 / 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 / 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 / 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 / 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) {