Skip to content

Instantly share code, notes, and snippets.

@mopa
mopa / pomodoro.sh
Last active September 10, 2023 08:13
CLI Pomodoro
#!/usr/bin/env bash
#
# Based on this https://gist.github.com/bashbunni/3880e4194e3f800c4c494de286ebc1d7
# Requirements: notify-send (should ship with your distro), lolcat, timer (https://github.com/caarlos0/timer)
# Example of usage: ./pomodoro.sh work
#
set -euo pipefail
declare -A pomo_options
@mopa
mopa / todoist_random_task_project.js
Created August 28, 2023 16:35
A Todoist bookmarklet to pick a random task from the current project
javascript: items = document.getElementsByClassName("task_list_item__content");
items[Math.floor(Math.random() * items.length)].click();
@mopa
mopa / todoist_random_task.js
Created August 28, 2023 16:33
A Todoist bookmarklet to pick a random task
javascript: (function () {
const token = "TOKEN";
fetch("https://api.todoist.com/rest/v2/tasks", {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
},
})
.then((response) => {
if (!response.ok) {
@mopa
mopa / docker-view-network.sh
Last active August 27, 2023 15:08
Script for view and copy the internal ip of a docker container
#!/usr/bin/env bash
set -euo pipefail
ID_WIDTH=$(docker ps --format "{{.ID}}" | awk '{ print length }' | sort -nr | head -n 1)
NAME_WIDTH=$(docker ps --format "{{.Names}}" | awk '{ print length }' | sort -nr | head -n 1)
IMAGE_WIDTH=$(docker ps --format "{{.Image}}" | awk '{ print length }' | sort -nr | head -n 1)
print_containers() {
docker ps --format "{{.ID}} {{.Names}} {{.Image}}" | while read -r id name image; do
@mopa
mopa / todoist_bookmarklet.js
Last active August 25, 2023 11:33
A simple bookmarklet to send the current web page to Todoist
javascript:(function() {
const token = 'TOKEN_ID';
const url = window.location.href;
const title = document.title;
const content = `[${title}](${url})`;
const data = {
'content': content,
'project_id': PROJECT_ID // Only if you want to send to specific project
};
@mopa
mopa / pandoc_simple_template.latex
Created March 24, 2018 18:11
A Pandoc simple template for LaTeX output files
\documentclass[10pt,a4paper,twoside]{article}
%=====================================================
% FONTS
%=====================================================
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\usepackage{microtype}
\usepackage{amsmath, amsthm, amssymb, bm, mathtools}