Skip to content

Instantly share code, notes, and snippets.

View alobbs's full-sized avatar
🏠
Working from home

Alvaro Lopez Ortega alobbs

🏠
Working from home
View GitHub Profile
@alobbs
alobbs / mail.gs
Created January 24, 2022 16:39
Automatic removal of old messages matching a GMail search string
/* Automatic removal of old messages matching a GMail search string
*
* Usage:
* Create a project at https://script.google.com/
* Based on:
* https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
*/
// Purge messages automatically after how many days?
var DELETE_AFTER_DAYS = 5
@alobbs
alobbs / gmail.py
Last active May 13, 2021 20:20
GMail from Python3
import base64
import pickle
import os.path
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
@alobbs
alobbs / gist:79bda3c528d6ca69be51465a09c63826
Last active January 19, 2020 02:45
Python3.8 alternative in Debian/Ubuntu
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 5
# update-alternatives --config python3
@alobbs
alobbs / rt.sh
Last active December 4, 2019 21:21
SSH+tmux
# SSH & attach tmux
rt() {
ssh -t "$1" 'tmux -2 attach-session -t $USER || {
tmux -2 new-session -d -t $USER
tmux set -g status-bg colour$(echo '"$1"' | md5sum | tr -d -c 0-9 | head -c 2)
tmux -2 attach-session -t $USER
}'
}
# Original version
@alobbs
alobbs / gist:37db6ba19433b3b023feee06eb98999f
Created January 5, 2019 19:10
Install UniFi controller in Raspbian
# UniFi repository
echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | tee -a /etc/apt/sources.list.d/100-ubnt.list
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
apt update
# Install packages
apt install oracle-java8-jdk unifi
# Disable MongoDB
systemctl stop mongodb
@alobbs
alobbs / etc_lightdm_lightdm.conf
Created December 16, 2017 22:26
Ubuntu 16.04 - lightdm
[SeatDefaults]
user-session=icewm-session
autologin-user=alo
autologin-user-timeout=0
@alobbs
alobbs / h265.sh
Created October 20, 2016 02:27
Quick alias to convert video files to H.265
toh265() {
ffmpeg -i "${1}" -c:v libx265 -preset medium -crf 28 -c:a aac -b:a 128k "${1}-h265.mp4"
}
@alobbs
alobbs / pdfclean
Created October 6, 2016 15:37
PDF Clean helper
pdfclean() {
exiftool -all:all= "$1"
qpdf --linearize "$1" "$1.tmp"
mv -f "$1.tmp" "$1"
}
@alobbs
alobbs / keybase.md
Created April 14, 2015 14:55
keybase.md

Keybase proof

I hereby claim:

  • I am alobbs on github.
  • I am alobbs (https://keybase.io/alobbs) on keybase.
  • I have a public key whose fingerprint is 83D2 19BA E8EA 42FD 9D2A 17BE E1E1 F5F2 944F 29AE

To claim this, I am signing this object: