Skip to content

Instantly share code, notes, and snippets.

@vibragiel
vibragiel / notify.py
Last active November 3, 2020 10:56
Desktop file for WeeChat. Place it in ~/.local/share/applications. The --class parameter and StartupWMClass key allow WeeChat to have a proper icon separated from gnome-terminal (e.g. in the Unity launcher). Also included the notify.py plugin to make the icon vibrate when mentioned.
# Author: lavaramano <lavaramano AT gmail DOT com>
# Improved by: BaSh - <bash.lnx AT gmail DOT com>
# Ported to Weechat 0.3.0 by: Sharn - <sharntehnub AT gmail DOT com)
# This Plugin Calls the libnotify bindings via python when somebody says your nickname, sends you a query, etc.
# To make it work, you may need to download: python-notify (and libnotify - libgtk)
# Requires Weechat 0.3.0
# Released under GNU GPL v2
#
# 2010-02-20, Aron Griffis <agriffis@n01se.net>
# version 0.0.5: Add nick_separator, don't call show_notification twice on
# Install F-Droid, Termux, Termux:API and Termux:Boot. Then open a Termux session and:
# pkg install curl && curl https://gist.github.com/gist_id | bash
PUBLIC_SSH_KEY_URL="https://gabi.is/id_rsa.chewie@gmail.com.pub"
pkg install openssh termux-api dnsutils
mkdir -p ~/.termux/boot/ ~/.ssh
[ -f ~/.termux/boot/daemons.sh ] || cat >~/.termux/boot/daemons.sh <<EOL
#!/data/data/com.termux/files/usr/bin/bash
termux-wake-lock
@vibragiel
vibragiel / duptools-gdrive.sh
Last active August 25, 2017 21:46 — forked from tsileo/duptools.sh
An example on how to use duplicity to perform encrypted incremental backups on Google Drive. Changes over tileo's original script: Google Drive instead of S3 as backend storage. Zenity dialogs to ask for credentials. IGNORE variable to exclude a list of directories from the backup. Verbosity raised to level 8. Activated asynchronous uploads.
#!/bin/bash
# directories to be included, space separated
SOURCE="/home/chewie /etc"
# directories to be excluded, space separated
IGNORE="/home/chewie/Downloads /home/chewie/Steam"
DRIVE_FOLDER="duplicity-backup"
LOGFILE=/home/chewie/duplicity.log
# set email to receive a backup report
EMAIL=""
@vibragiel
vibragiel / emoji_bookmarklet.md
Last active March 10, 2017 15:56
Bookmarklet to show quick unicode emojis for quick copy&pasting.

#Emoji bookmarklet

This bookmarklet shows the unicode Emojis in your native font for quick copy&pasting. Depending on your system, some (or all) of them may not render properly.

Create a bookmark in your bookmarks toolbar and paste the following code into the URL/Location field:

javascript: (function () {
alert("😁 😂 😃 😄 😅  🕦 🕧 😊 😋 😌 😍 😏 😒 😓 😔 😖 😘 😚 😜 😝 😞 😠 😡 😢 😣 😤 😥 😨 😩 😪 😫 😭 😰 😱 😲 😳 😵 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀 🙅 🙆 🙇 🙈 🙉 🙊 🙋 🙌 🙍 🙎 🙏 ✂ ✅ ✈ ✉ ✊ ✋ ✌ ✏ ✒ ✔ ✖ ✨ ✳ ✴ ❄ ❇ ❌ ❎ ❓ ❔ ❕ ❗ ❤ ➕ ➖ ➗ ➡ ➰ 🚀 🚃 🚄 🚅 🚇 🚉 🚌 🚏 🚑 🚒 🚓 🚕 🚗 🚙 🚚 🚢 🚤 🚥 🚧 🚨 🚩 🚪 🚫 🚬 🚭 🚲 🚶 🚹 🚺 🚻 🚼 🚽 🚾 🛀 Ⓜ 🅰 🅱 🅾 🅿 🆎 🆑 🆒 🆓 🆔 🆕 🆖 🆗 🆘 🆙 🆚 🇩🇪 🇬🇧 🇨🇳 🇯🇵 🇰🇷 🇫🇷 🇪🇸 🇮🇹 🇺🇸 🇷🇺 🈁 🈂 🈚 🈯 🈲 🈳 🈴 🈵 🈶 🈷 🈸 🈹 🈺 🉐 🉑 © ® ‼ ⁉ 8⃣ 9⃣ 7⃣ 6⃣ 1⃣ 0⃣ 2⃣ 3⃣ 5⃣ 4⃣ #⃣ ™ ℹ ↔ ↕ ↖ ↗ ↘ ↙ ↩ ↪ ⌚ ⌛ ⏩ ⏪ ⏫ ⏬ ⏰ ⏳ ▪ ▫ ▶ ◀ ◻ ◼ ◽ ◾ ☀ ☁ ☎ ☑ ☔ ☕ ☝ ☺ ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓ ♠ ♣ ♥ ♦ ♨ ♻ ♿ ⚓ ⚠ ⚡ ⚪ ⚫ ⚽ ⚾ ⛄ ⛅ ⛎ ⛔ ⛪ ⛲ ⛳ ⛵ ⛺ ⛽ ⤴ ⤵ ⬅ ⬆ ⬇ ⬛ ⬜ ⭐ ⭕ 〰 〽 ㊗ ㊙ 🀄 🃏 🌀 🌁 🌂 🌃 🌄 🌅 🌆 🌇 🌈 🌉 🌊 🌋 🌌 🌏 🌑 🌓 🌔 🌕 🌙 🌛 🌟 🌠 🌰 🌱 🌴 🌵 🌷 🌸 🌹 🌺 🌻 🌼 🌽 🌾 🌿 🍀 🍁 🍂 🍃 🍄 🍅 🍆 🍇 🍈 🍉 🍊 🍌 🍍 🍎 🍏 🍑 🍒 🍓 🍔 🍕 🍖 🍗 🍘 🍙 🍚 🍛 🍜 🍝 🍞 🍟 🍠 🍡 🍢 🍣 🍤 🍥 🍦 🍧 🍨 🍩 
@vibragiel
vibragiel / emoticons_bookmarklet_standalone.md
Created April 10, 2014 11:28
Bookmarklet to show handy copyable emoticons. Standalone version.

#Look Of Disapproval bookmarklet

This bookmarklet shows the look of disapproval emoticon, plus a bunch of other handy ones. It's based on maciak's bookmarklet, but uses an alert() instead.

Create a bookmark in your bookmarks toolbar and paste the following code into the URL/Location field:

javascript: (function () {
alert("ಠ_ಠ\nಠ_ರೃ\nಥ_ಥ\nಥ◡ಥ\nಠ╭╮ಠ\n⊙▃⊙\n(╯°□°)╯︵ ┻━┻\n¯\_(ツ)_/¯\n(╥﹏╥)\n◉‿◉");
}());

Assignments when inline if is false

[1] pry(main)> piticli = "wadus" if false
=> nil
[2] pry(main)> defined? piticli
=> "local-variable"
[3] pry(main)> h = {}; h[:piticli] = "wadus" if false
=> nil
[4] pry(main)> h.key? :piticli
@vibragiel
vibragiel / 350_exim4-config_vdom_aliases
Created July 3, 2013 18:14
Fichero router para exim4, a colocar en /etc/exim4/conf.d/router, para permitir dominios y usuarios de correo virtuales. Dentro de /etc/mail/virtual/ hay que crear un fichero por cada dominoi, y dentro los alias de correo que se mapean a usuarios locales.
router_virtualdomains:
driver = redirect
domains = dsearch;/etc/mail/virtual
data=${lookup{$local_part}lsearch*{/etc/mail/virtual/$domain}}
no_more
@vibragiel
vibragiel / notable-absences.py
Last active December 12, 2015 08:39
This script retrieves the interlanguage links for every featured article in the English Wikipedia and prints a list of those articles not present in the Wikipedia language provided as a command line parameter. The list is sorted on the total number of interlanguage links of the articles. That is, it shows good articles present in many Wikipedias…
#/usr/bin/env python
# -*- coding: utf8 -*-
# notable-absences.py - Prints a list of featured articles in the English
# Wikipedia which are not present in the provided
# Wikipedia language, sorted by the number of
# interlanguage links of the article. That is, notable
# articles present in many Wikipedias, but not on the
# provided one.
#
# Copyright (C) 2012 Gabriel Rodríguez Alberich <chewie@gmail.com>
@vibragiel
vibragiel / multigrafias.json
Created February 6, 2013 17:21
Palabras del español que tienen varias escrituras distintas, en JSON. Albóndiga o almóndiga, cuásar o quásar, raíl o rail, faba o haba... ¡Hay más de 4000!
[
[
"abajar",
"bajar"
],
[
"abalaustrado",
"balaustrado"
],
[
@vibragiel
vibragiel / parse_papeles.py
Created February 3, 2013 15:28
Script para convertir los papeles de Bárcenas publicados por EL PAÍS a json.
# -*- coding: utf8 -*-
import re
import json
from lxml import html
try:
from urllib2 import urlopen
except ImportError:
from urllib import urlopen
PAPELES_URL = "http://elpais.com/especiales/2013/caso_barcenas/" \