Skip to content

Instantly share code, notes, and snippets.


Radosław Woźniak radwo

View GitHub Profile
jmatsushita / README
Last active Sep 24, 2022
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
# Inspired by I highly recommend looking at malob's repo for a more thorough configuration
# Let's get started
# Let's install nix (at the time of writing this is version 2.5.1
curl -L | sh
# I might not have needed to, but I rebooted
View Set up nix & home-manager in macoS Big Sur 11
# Instructions for fresh install
$ sh <(curl -L --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/' | tee -a ~/.zshrc
$ nix-channel --add
$ nix-channel --add darwin
$ nix-channel --add home-manager
castwide / rails.rb
Last active Sep 6, 2022
Enhance Rails Intellisense in Solargraph
View rails.rb
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
# @!parse
# class ActionController::Base
troyfontaine /
Last active Sep 23, 2022
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in to reflect my findings.

olivierlacan /
Last active Mar 24, 2022
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide:

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:


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

eoinkelly /
Last active Nov 9, 2017
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
mattt / NSDecimalNumber.swift
Last active Sep 17, 2022
NSDecimalNumber Additions for Swift
View NSDecimalNumber.swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return == .OrderedSame
floriankugler / gist:6870499
Last active Apr 3, 2022
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
View gist:6870499
NSURLConnection | NSURLSession
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
willurd /
Last active Sep 22, 2022
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000