Skip to content

Instantly share code, notes, and snippets.

View paulera's full-sized avatar

Paulo Amaral paulera

View GitHub Profile
@paulera
paulera / agile-resources.md
Last active July 29, 2018 10:30
Resources related to Agile methodologies
@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 / 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 / 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 / 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 / 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 / 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 / file_permissions.sh
Created February 26, 2018 15:07
Set file permissions 775 for dirs and 664 for files
#!/bin/bash
#
# This will set
# Directories: 775 (read-write-exec for owner and group, read-exec for others)
# Files: 664 (read-write for owner and group, read for others)
# for all files expect .git folder.
# --> Remove `-name .git -prune -o` to extend it to git files.
find . -name .git -prune -o -type d -exec chmod 775 {} \;
find . -name .git -prune -o -type f -exec chmod 664 {} \;
@paulera
paulera / xdebug.php.ini
Last active January 25, 2019 09:30
PHP configuration for enabling XDebug, including profiler and tracer
; All settings: https://xdebug.org/docs/all_settings
; DEBUGGER
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_log=/tmp/xdebug/xdebug.log
xdebug.var_display_max_data=2048
xdebug.var_display_max_depth=5
@paulera
paulera / server_config_notes.md
Created February 22, 2018 07:16
Server configuration

iptables

Security settings

iptables -F
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
#this is to get rid of null packets
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
#defend syn-flood attacks