Skip to content

Instantly share code, notes, and snippets.

View humitos's full-sized avatar
💭
Drinking 🧉. Always.

Manuel Kaufmann humitos

💭
Drinking 🧉. Always.
View GitHub Profile
;; Solución ELISP a http://elblogdehumitos.com.ar/posts/wordpress/no-mas-mate-frio/
(global-set-key (kbd "C-c m") 'mate-start-stop)
(defun mate-start-stop ()
"Start or stop the current timer"
(interactive)
(if (eq mate-say-cancel-id nil)
(progn
(mate-say-start)
# -*- coding: utf-8 -*-
# AWFUL synchronic version of NoSpotifyAds: the main idea is to detect silent
# into the stream and chunk it between of those silent. Then, if the chunk is
# between 25 and 35 seconds, instead of playing the ads we play a silent.
# OBVIOUS: it doesn't work! :)
# WHY?: it needs to be asynchronic. While we are playing, we need to detect
# silent and prepare the next chunk to be played.
@humitos
humitos / spotify-noads.py
Last active February 21, 2021 03:12
Remove Ads from Spotify Linux client by mutting the audio system
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# python 2.7.12
# it shows more differences than it should, since shows all the 'u' from
# Unicode keys from the dictionaries
# my main problem with this is when we do not control the data (for example
# when it's generated in another file that does not use `unicode_literals` from
# `__future__` since we have no control over that
[21:07] humitos: ~> python
Python 2.7.12 (default, Jul 18 2016, 15:02:52)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import unicode_literals
>>> 'a'
u'a'
>>> # :)
...
>>> import md5
;; Reproduction of
;; https://stackoverflow.com/questions/45907854/browse-url-generic-program-as-a-safe-local-variable-values
(custom-set-variables
'(safe-local-variable-values
(quote
(
(browse-url-generic-program "firefox")
(browse-url-generic-program "google-chrome")
))))
@humitos
humitos / gist:8553640a9ce1272ccd83861ed233d03c
Created November 12, 2017 01:22
Bluetooth error on Archlinux
nov 11 20:21:10 julia kernel: Bluetooth: hci0 link tx timeout
nov 11 20:21:10 julia kernel: Bluetooth: hci0 killing stalled connection fc:a8:9a:b9:45:14
nov 11 20:21:10 julia kernel: Bluetooth: hci0 link tx timeout
nov 11 20:21:10 julia kernel: Bluetooth: hci0 killing stalled connection fc:a8:9a:b9:45:14
nov 11 20:21:12 julia bluetoothd[3336]: Disconnecting failed: already disconnected
nov 11 20:21:16 julia bluetoothd[3336]: Close: Connection timed out (110)
nov 11 20:21:16 julia kernel: Bluetooth: hci0 link tx timeout
nov 11 20:21:16 julia kernel: Bluetooth: hci0 killing stalled connection fc:a8:9a:b9:45:14
nov 11 20:21:18 julia bluetoothd[3336]: Abort: Connection timed out (110)
nov 11 20:21:18 julia kernel: Bluetooth: hci0 link tx timeout
@humitos
humitos / active_project.py
Last active January 31, 2022 16:40
Minimal implementation to check if a project can be considered "active" under a window of certain past months
import datetime
from django.utils import timezone
from readthedocs.analytics.models import PageView
from readthedocsext.spamfighting.utils import spam_score
def is_active_project(
@humitos
humitos / postgres_queries_and_commands.sql
Last active May 16, 2022 09:05 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- running queries
SELECT pid, age(clock_timestamp(), query_start), usename, state, query
FROM pg_stat_activity
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@humitos
humitos / sport-tracker-gpx.js
Last active November 19, 2022 09:39
Download a URL workout from Sport Tracker as GPX
// Download file from https://www.sports-tracker.com/
// Example: https://www.sports-tracker.com/workout/jaumenarbona/61b508ae59ba772af9278c87
//
// Based on:
// - https://ivanderevianko.com/2016/04/export-all-workouts-from-sports-tracker
// - https://gist.github.com/KonstantinosSykas/dfe4c5e392e299ab9341d6e16299454f
//
//
// Instructions:
// 1. Open the URL of the workaround you want to export