Skip to content

Instantly share code, notes, and snippets.

@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@dabrahams
dabrahams / gist:3030332
Created July 2, 2012 01:10
My new, simpler offlineimap configuration
# -*- mode: conf; -*-
#
# NOTE: Settings generally support python interpolation. This means
# values can contain python format strings which refer to other values
# in the same section, or values in a special DEFAULT section. This
# allows you for example to use common settings for multiple accounts:
#
# [Repository Gmail1]
# trashfolder: %(gmailtrashfolder)s
#
@zargony
zargony / ipv6proxy
Last active May 5, 2024 14:52
Automatic SSH jump host for IPv6-only hosts
#!/bin/sh
# Automatic SSH jump host for IPv6-only hosts.
# Usage in ~/.ssh/config: ProxyCommand ~/.ssh/ipv6proxy <jumphost> %h %p
# If a host is reachable via IPv6, a direct connection is made.
# Otherwise a jump host is used (which shall support IPv6).
if ping6 -c1 $2 >/dev/null 2>&1; then
exec nc -6 $2 $3
else
exec ssh -q $1 "nc -6 $2 $3"
@shazow
shazow / meta.py
Created March 6, 2013 23:20
My latest SQLAlchemy model base class.
"""SQLAlchemy Metadata and Session object"""
import datetime
import json
import time
from sqlalchemy import MetaData
from sqlalchemy.orm import scoped_session, sessionmaker
__all__ = ['Session', 'metadata', 'Model', 'SchemaEncoder']
@miguelmota
miguelmota / README.md
Last active November 9, 2024 16:50
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@luckydonald
luckydonald / cubietruck_gpio.md
Last active June 23, 2024 20:59
How to setup and use GPIO ports/pins on a Cubietruck

Setup and use GPIOs on a Cubietruck

Cubietruck is also known as Cubieboard 3

Note: This file documents just what I did, first of all as a note for myself. So this is not primarily intended as a tutorial. Because it still might be helpfull, I uploaded it. The GPIO function is now confirmed to work, tested with my multimeter, but I am still waiting for my jumper cables to arrive, so I can use them securely.

Licensed under a Luna-Will-Cry-If-You-Modify-Or-Redistribute-This 1.0 licence.

@mturquette
mturquette / .offlineimaprc
Created January 18, 2016 06:29
OfflineIMAP nametrans and folderfilter example
[Repository local-baylibre]
...
nametrans = lambda folder: {
'drafts': '[Gmail]/Drafts',
'flagged': '[Gmail]/Starred',
'important': '[Gmail]/Important',
'inbox': 'INBOX',
'spam': '[Gmail]/Spam',
'trash': '[Gmail]/Trash',
}.get(folder, folder)
@mjhea0
mjhea0 / audit_mixin.py
Created December 7, 2016 14:12 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@treethought
treethought / get_or_creat.py
Created March 30, 2017 06:48
Get or create an object with SQLAlchemy
# http://stackoverflow.com/questions/2546207/does-sqlalchemy-have-an-equivalent-of-djangos-get-or-create
# credit to Wolf
def get_or_create(session, model, defaults=None, **kwargs):
instance = session.query(model).filter_by(**kwargs).first()
if instance:
return instance, False
else:
params = dict((k, v) for k, v in kwargs.iteritems() if not isinstance(v, ClauseElement))
params.update(defaults or {})
@guiniol
guiniol / aliases.muttrc
Last active October 27, 2024 09:44
neomutt configuration with notmuch
alias YOU YOUR NAME <[email protected]>