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

@ololduck
ololduck / bot.rb
Created March 17, 2012 15:32
Ruby IRC bot
#!/usr/bin/env ruby
require 'socket'
class BotIRC
# initialize:
# @param: server Le serveur auquel se connecter
# pseudo Le pseudo IRC du bot. Sera aussi utilisé en USER
# chans Une liste des chans auquels le bot doit se connecter
@goakley
goakley / linus.c
Last active December 10, 2020 00:34
In response to: http://meta.slashdot.org/story/12/10/11/0030249/linus-torvalds-answers-your-questions An explanation of the two different types of singly-linked list removal explained by Linus Torvalds, using the variable names introduced here: http://stackoverflow.com/questions/12914917/
#include <stdio.h>
typedef struct ll {
int value;
struct ll *next;
} ll;
void print_list(ll *list_head)
{
@mislav
mislav / _readme.md
Last active June 28, 2024 15:16
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@prwhite
prwhite / Makefile
Last active June 11, 2024 13:48
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@blacktm
blacktm / install_ruby_rpi.sh
Last active May 26, 2024 15:13
A Bash script to install Ruby on the Raspberry Pi
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Set the Ruby version you want to install
@roundand
roundand / OpenWithSublimeText3.bat
Last active June 29, 2024 01:16 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@ProjectCleverWeb
ProjectCleverWeb / centered.md
Last active September 20, 2023 09:46
Example of how to do centered text and images in Githb Flavored Markdown
@Skyost
Skyost / GithubUpdater.java
Last active June 20, 2017 22:26
An update checker based on Github.
/**
* An update checker based on Github.
* <br>The file "version.update" must contain a valid version.
*
* @author Skyost.
* @see <a href="https://gist.github.com/Skyost/e3389e6f40642785fccc">The gist's link</a> or the <a href="http://paste.skyost.eu/skyost-5554ebf124a9c">paste's link</a>.
*/
public class GithubUpdater extends Thread {