Skip to content

Instantly share code, notes, and snippets.


Mathieu Aubin mathieu-aubin

View GitHub Profile
mathieu-aubin / com.vsubhash.bash.twitter-to-pdf.txt
Created Feb 9, 2022 — forked from vsubhash/com.vsubhash.bash.twitter-to-pdf.txt
com.vsubhash.bash.twitter-to-pdf.txt is a Unix/Linux shell script for saving all messages posted by a Twitter account as an archive in PDF format.
View com.vsubhash.bash.twitter-to-pdf.txt
if [ $# -lt 2 ]; then
echo -e "The format is:\n\t\e[35m`basename $0` \e[35;1mtwitter-handle-or-hashtag number-of-tweets [nojs]\e[0m"
# A backup of all files will be available in this Logs directory
if [ ! -d ~/Logs ]; then
mkdir ~/Logs
cd ~/Logs
View base64-wdata
if [ ! -e "${1}" ]; then
echo "File not found";
echo "Usage: $(basename "${0}") input_file";
type=$(file --mime-type --brief "${1}");
w="$(echo $type|cut -d/ -f2)";
raw=$(cat "${1}" | base64 -iw0 | sed 's| ||g');
mathieu-aubin / dlpatent
Last active Jun 22, 2022
Download PDF patent files from using download url and description
View dlpatent
# Downloads patent files from as pdf
# Must provide 2 arguments which are.. (quotes encapsulated)
# File URL (pdf download link)
# Description or name of patent
# File will be saved as PATENT#_DESCRIPTION.pdf

An engineering manager that I have the privilege of working with just asked me for three expectations of a principal engineer for a project that he is working on to mentor senior engineers at Twilio. Here is the list that I came up with.

  • Skate to where the puck is going: Are you waiting to be told what to do or are you getting a sense for our product vision and making concrete suggestions for what technical work needs to be done to get us in a good place when it becomes time to execute?
  • Act like an owner: Are you complaining about what's broken or offering solutions and/or alternative ways of thinking that makes it clear to engineers close to the problem that they can play an important role in solving those problems? Do you accept the world as it is or are you willing to provide a compelling vision for how it could be?
  • Teach and lead: You're not getting more hours in the day. Taking on all of the hard work not only makes you a single point of failure, it robs your colleagues of the ability
View play.html
<html lang="en">
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width,minimum-scale=1.0"/>
<style type="text/css">
video {
mathieu-aubin /
Last active Apr 23, 2021
Grab User-Agents from access logs with typical structure
zcat /var/log/*/*access*.gz | grep -Ev '(robots|humans).txt|favicon' | awk -F\" '($2 ~ "^GET /"){print $6}' | \
grep -Eiv "^-$|^$|Wordpress|^WOW$|wget|^curl.+|WhatsApp|Twitter|TOBBOT|GoogleBot|AdsBot|Baidu|Crawl|TurnitinBot|random|knowledge|smurl|thither|urlcheck|Traackr|Spider|^Z$|Zoom|chr\(|test|scrapy|ruby|SafeDNS|Research|Whatweb|semrush|seobility|slack|scan|yahoo|requests|reqwest|queue|serende|yakuza|zmeu|zoxh|xenu|semantic|siri|tagvisit|wapp|p40|PHP|cfnetwork|Pattern|python|seeker|scamadviser|\\x|pinterest|Pocket|thumbor|photon|null|okhttp|panscient|pa11y|OnalyticaBot|fetch|my_linux|powered|node\.js|newspaper|zgrab|gnowit|gzip|lighthouse|Datanyze|7777|MAUI|J2ME|seznam|proxy|detection|libwww|survey|hakai|nmap|go-http-client|PROBT|Nimbostratus|^Mozilla\/[[:digit:]].[[:digit:]][[:digit:]]?$|5.01682558|Mozilla\/5.0 Mozilla\/5.0|Zend|user-agent|symfony|poster|Writter|Rome|project25499|SMTB|^Mozilla [[:digit:]].[[:digit:]]|^Mozilla\/[[:digit:]].[[:digit:]]$|^Mozilla$|WebDav|Ahrefs|aiHitBot|Cloud
UHEADTMP=$(mktemp -t mysqltmp_uheader_XXXXXXX);
USRTMP=$(mktemp -t mysqltmp_usr_XXXXXXX);
USRGRTMP=$(mktemp -t mysqltmp_usrgr_XXXXXXX);
mathieu-aubin /
Created Feb 5, 2019
url encoding and decoding in bash
url-encode ()
if [[ ! -z ${2} || -z ${1} ]]; then
echo "error: this command needs one and only one value";
echo " enclose spaces or special chars with quotes";
return 1;
local string strlen encoded pos proto c o;
View perlbrew-completion.bash
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
export PERLBREW="command perlbrew"
_perlbrew_compgen() {
complete -F _perlbrew_compgen perlbrew