Skip to content

Instantly share code, notes, and snippets.

@rafasc
rafasc / .constellation-hostnames.md
Created March 20, 2023 11:48 — forked from virchau13/.constellation-hostnames.md
Server cluster hostnames from constellations

What?

A list of constellations with associated hostname-compatible star names in a JSON format.

Why?

Ever wanted to name servers with more friendly names than DB-13, but had no idea what to name them? Simply name each server in your cluster after a star in a constellation! This way, you have a common 'group' under which to put every server, and you will have no problems whatsoever. I use the Aquila constellation for my jumbled mess that I call a network.

@rafasc
rafasc / 1-output.txt
Last active August 28, 2019 19:22
multiline.pl crash
$ weechat -t
*** Very bad! WeeChat is crashing (SIGSEGV received)
*** Full crash dump was saved to /tmp/weechat_temp_0zxUGE/weechat_crash_20190828_13836.log file.
***
*** Please help WeeChat developers to fix this bug:
***
*** 1. If you have a core file, please run: gdb /path/to/weechat core
*** then issue command: "bt full" and send result to developers.
*** See the user's guide for more info about enabling the core files
#!/usr/bin/env python
# -*- coding: utf-8 vi:noet
# Dump a clear-text version of an SSH key from gpg-agent
__author__ = "Jérôme Carretero <cJ-tub@zougloub.eu>"
__licence__ = "MIT"
import sys, io, subprocess, re, ctypes
libgcrypt = ctypes.CDLL("libgcrypt.so")
@rafasc
rafasc / gist:b4426b8b59bf64e8fecb3aa94ee564ec
Created March 22, 2018 03:46 — forked from fredreichbier/gist:4399625
How to extract your private ssh key from gpg-agent

How to extract a SSH private key from gpg-agent

Problem: Lost private key file ~/.ssh/id_rsa, but could connect to remote hosts via pubkey auth anyway: gpg-agent cached the private key. How to get the private key?

Solution: Use gpg-protect-tool to get the key (you need to know the passphrase of course):

gpgsm --call-protect-tool --p12-export ~/.gnupg/private-keys-v1.d/your-keyfile.key >key.p12

Now you have a PKCS12 file and you can extract the private key like this:

@rafasc
rafasc / 0main.md
Created March 12, 2018 11:20 — forked from canton7/0main.md
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

@rafasc
rafasc / NASA Picture-Of-The-Day Wallpaper Script
Created November 20, 2016 20:33 — forked from JoshSchreuder/NASA Picture-Of-The-Day Wallpaper Script
A BASH script to download NASA's picture of the day (http://apod.nasa.gov/apod/astropix.html) automatically saving and setting as wallpaper and saving optional description of image to text.
#!/bin/bash
# Copyright (c) 2011 Josh Schreuder
# http://www.postteenageliving.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@rafasc
rafasc / state.py
Created February 28, 2016 00:05 — forked from ambv/state.py
Stateful methods with PEP 443 single-dispatch generic functions.
from decimal import Decimal
from functools import singledispatch
#
# @singledispatch has to be moved inside __init__ to
# make registration work per instance.
#
class State:
def __init__(self):
@rafasc
rafasc / autosub.lua
Created November 15, 2015 02:12 — forked from selsta/autosub.lua
Automatically download subtitles in mpv using subliminal.
-- requires subliminal, version 1.0 or newer
-- default keybinding: b
-- add the following to your input.conf to change the default keybinding:
-- keyname script_binding auto_load_subs
local utils = require 'mp.utils'
function load_sub_fn()
subl = "/usr/local/bin/subliminal" -- use 'which subliminal' to find the path
mp.msg.info("Searching subtitle")
mp.osd_message("Searching subtitle")
t = {}