Skip to content

Instantly share code, notes, and snippets.

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
$is_windows = [environment]::OSVersion.Platform.ToString().ToLower().StartsWith("win")
$app_name = "Lumy"
$script_dir = $PSScriptRoot
#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
$is_windows = [environment]::OSVersion.Platform.ToString().ToLower().StartsWith("win")
$app_name = "Lumy"
# https://pypi.org/project/appdirs/
import itertools
def dict_product(dicts):
"""
Cartesian product.
See https://stackoverflow.com/questions/5228158/cartesian-product-of-a-dictionary-of-lists
>>> list(dict_product(dict(number=[1,2], character='ab')))
[{'character': 'a', 'number': 1},
{'character': 'a', 'number': 2},
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theorm
theorm / cantons.geojson
Last active March 23, 2020 17:38
Lu Geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<script>
export default {
name: 'test-component',
functional: true,
props: {
children: Array
},
render (h, context) {
return (context.props.children || []).map(child => {
if (typeof child === 'string') return child
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
filename = 'ts.txt'
out_filename = 'ts_with_entities.txt'
cnt = 0
with open(filename) as f:
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# Determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh
else
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start