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...

@gak
gak / fish-prompt.sh
Last active February 4, 2022 18:34
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
function _common_section
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c2
printf $argv[2]
printf $argv[3]
printf $c0
printf ", "
@danfinlay
danfinlay / How to download streaming video.md
Last active March 23, 2024 03:32
How to download a streaming video with Google Chrome

How to download streaming video

Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.

Open Developer Tools

From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:

1.  (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@noborus
noborus / gist:7516369
Last active March 25, 2021 10:06
iBus(1.4)をD-Busで操作する方法

iBus(1.4)をD-Busで操作する方法

iBusはD-Busを通信プロトコルに使用しているため、外からもD-Busで制御することが出来る。 しかしながら、D-Busが一般に使用するSystem Bus と Session Busとは違うBusを使用するため、ちょっと注意が必要になる。

iBus1.5からはデスクトップ環境に統合されることを前提に変更されているため、ここではその変更前のバージョンを対象とする。

iBusのD-Busに接続するための接続情報

iBusのD-Busに接続するための接続するには IBUS_ADDRESSが必要になる。IBUS_ADDRESSは通常 iBusを起動しているユーザーの

@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@vodik
vodik / rez-x
Last active November 23, 2021 20:54
startx alternative
#!/bin/bash
# startx
# Alternative, simpler startx which makes use of the XDG specification
# - assumes dbus is already running
[[ -n "$DISPLAY" ]] && exit 0
[[ -z "$XDG_VTNR" ]] && exit 1
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
@h4cc
h4cc / howto.md
Last active November 28, 2022 12:53
Getting Thumbnails / Previews of your RAW files in Ubuntu

Howto

Install these programms

sudo apt-get install gnome-raw-thumbnailer ufraw-batch

Try now if everything works, and your thumbnails show up. If not, try the following part.

@theskumar
theskumar / app.py
Created November 17, 2014 06:47
Database diagram using sqlalchemy
# -*- coding: utf-8 -*-
''' Generates database schema graph from a relational database.
Usages:
Add database configuation in this file and then
python app.py
Note: You must have your latest database schema in the database
engine you are running against.
'''
from __future__ import unicode_literals, absolute_import
@czardoz
czardoz / background_flask.py
Created April 21, 2015 10:45
Simple Flask app with a background task using gevent
import gevent
import gevent.monkey
gevent.monkey.patch_all()
from gevent.pywsgi import WSGIServer
from flask import Flask
app = Flask(__name__)
app.debug = True
@hmanicka
hmanicka / app.py
Last active April 30, 2021 15:22
Flask-Admin: To update timestamp with timezone field with UTC
import pytz
class MyView(MyModelView):
# Display the time in user's local timezone on the List View
column_formatters =
dict(scheduledtime=lambda v,c,m,p: m.scheduledtime.replace(tzinfo=pytz.utc).astimezone(tz=pytz.timezone(config.LOCAL_TIMEZONE)))
# Display the time in user's timezone on the Edit View
def edit_form(self, obj):
form = self._edit_form_class(get_form_data(), obj=obj)