Skip to content

Instantly share code, notes, and snippets.

View paulera's full-sized avatar

Paulo Amaral paulera

View GitHub Profile
@paulera
paulera / ororotv-random_episode_button.js
Last active November 16, 2020 11:31
Tampermonkey script that adds a "Random" button to TV Shows episodes list in the streaming service ororo.tv
/***
This script works only in ororo.tv. It adds a "Random" button in "TV Show" episodes list.
To activate it:
method 1: On a TV Show episodes list page, open the console, copy and paste all this code, and press enter.
method 2: Create an entry in your bookmarks called "Ororo random episode" with the url exacty as below. Use it in TV Show episodes list.
javascript:function openRandomEpisode(){do{episodeInfo=getRandomEpisode()}while(window.episodes.length&&window.prioritizeUnwatched&&episodeInfo.watched&&!window.allEpisodesWatched);0==window.episodes.length&&episodeInfo.watched&&(console.log("Could not find an unwatched episode"),window.allEpisodesWatched=!0),activateSeason(episodeInfo.season),scrollToEpisode(episodeInfo),console.log("Start episode: Season "+episodeInfo.season+" Episode "+episodeInfo.number),episodeInfo.linkElement.click()}function getRandomEpisode(){return window.getRandomEpisodeCount++,console.log("Looking for a random episode (try #"+window.getRandomEpisodeCount+")"),0==window.episodes.l
@paulera
paulera / sdc
Last active March 28, 2018 09:25
Site Data Scraper - retrieve google analytics and tag manager info from a page
#!/bin/bash
# Site Data scraper script
#
# USAGE: sd www.example.com
#
if [ -z $1 ]; then
echo Usage: $(basename $0) www.example.com
exit 1;
@paulera
paulera / find-script-src.sh
Created April 19, 2018 16:11
Script to find all <script src="...."> in a URL source code
#!/bin/bash
if [ -z $1 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo "Usage: "$(basename $0)" <url>"
echo
echo "This script finds all external scripts referred by <script> tags"
exit 1
fi
curl -L -s "$1" | tr '\r\n\t' ' ' | sed $'s/\(<\/[^>]*>\)/\\1\\\n/g' | sed 's/^ *//;s/ *$//' | grep "^<script" | grep --color=always "src=[\"'][^\"']\+[\"']" | while read i; do echo -e $i"\n"; done
@paulera
paulera / timezone-clock.html
Last active November 16, 2020 11:29
Display the current time HH:MM for a given timezone
<html>
<body>
<!-- See live at https://codepen.io/paulera/pen/BPwPNw -->
<p class="clock" timezone="+2"></p>
<p class="clock" timezone="+4"></p>
<p class="clock" timezone="-7"></p>
<script>
@paulera
paulera / proxyed-chrome.sh
Last active November 16, 2020 11:28
Opens google chrome in a blank session tunnelled using a socks5 proxy
#!/bin/bash
# Opens google chrome for using a socks5 proxy
# Hoe to opem a SOCKS5 proxy:
# ssh -o ServerAliveInterval=30 -D 3123 [email protected]
CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
PORT=3123
TMP_PROFILE_DIR="/tmp/proxyed-chrome-profile"
@paulera
paulera / gitall.sh
Last active November 16, 2020 11:26
Run a git command in all folders (same level, not recursive) that are a git repo.
#!/bin/bash
#
# Usage: gitall status
# gitall fetch
# gitall checkout master
# gitall ...git parameters...
#
if [[ "$OSTYPE" =~ "darwin" ]]; then
# MAC
@paulera
paulera / agile-resources.md
Last active July 29, 2018 10:30
Resources related to Agile methodologies
@paulera
paulera / browser-auto-scroll.md
Last active April 18, 2021 21:42
Smart bookmarks that add auto-scrolling functionality to the browser

Create bookmarks as per below to automate scrolling

Name URL
slower javascript:if (typeof window.scrollLines === 'undefined') { window.scrollLines = 1; } if (typeof window.scrollInterval === 'undefined') { window.scrollInterval = 1; } ; if (window.scrollLines > 1) { window.scrollLines--; window.scrollInterval = 1; } else { window.scrollLines = 1; window.scrollInterval += 25; }; clearInterval(window.scrollHandler) ; window.scrollHandler = setInterval(function() { window.scrollBy(0, window.scrollLines); }, window.scrollInterval ); window.scrollLines; window.scrollInterval;
pause javascript:clearInterval(window.scrollHandler);
play `javascript: if (typeof window.scrollLines === 'undefined') { window.scrollLines = 1; } ; if (typeof window.scrollInterval === 'undefined') { window.scrollInterval = 1; } ; clearInterval(window.scrollHandler) ; window.scrollHandler = setInterval(function() { window.scrollBy(0, window.scrollLines); }, window.scrollInt
@paulera
paulera / gimme.sh
Last active November 16, 2020 11:22
Switch branch and pull changes (fetch + checkout + pull) preserving local changes (using stash)
#!/bin/bash
git1() {
STASH="gimme-cmd-stash-"$(date +"%s")i
git stash save $STASH
STASH_REF="$(git stash list | grep "$STASH" | awk -F: '{ print $1 }')"
git fetch && git checkout $1 && git pull
if [ "$STASH_REF" != "" ]; then
git stash pop "$STASH_REF"
else
@paulera
paulera / burndown.html
Last active July 15, 2021 07:31
Burndown chart built using Chart.js
<html>
<!-- See live at https://codepen.io/paulera/pen/ejGKEr -->
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<script>
/**
* Sum elements of an array up to the index provided.
*/