Skip to content

Instantly share code, notes, and snippets.

@swdunlop
swdunlop / mustang.toml
Created March 17, 2022 00:05
Port of Mustang theme to the Helix text editor
# Author: Scott W. Dunlop <[email protected]>
# Derived from RayGervais <[email protected]>
# Original Mustang color theme: https://www.deviantart.com/hcalves/art/Mustang-Vim-Colorscheme-98974484
"ui.background" = { bg = "base00" }
"ui.menu" = "base01"
"ui.menu.selected" = { fg = "base01", bg = "base04" }
"ui.linenr" = { fg = "base03", bg = "base01" }
"ui.popup" = { bg = "base01" }
"ui.window" = { bg = "base01" }
@swdunlop
swdunlop / Dockerfile
Created September 28, 2021 19:22
Rootless Nix Dev Container for Visual Code hackers
# See here for base image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/alpine/.devcontainer/base.Dockerfile
ARG ALPINE_VERSION="3.14"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-alpine-${ALPINE_VERSION}
USER root
# https://nvd.nist.gov/vuln/detail/CVE-2019-5021
RUN sed -i -e 's/^root::/root:!:/' /etc/shadow
@swdunlop
swdunlop / README.md
Last active May 7, 2021 18:50
A script to fix Visual Code Remoting via SSH to NixOS after the April 2021 update

NixOS does not normally install libraries in a FHS layout, which means that binaries compiled for other Linux platforms typically will not work. Visual Studio Code's Remote SSH extension transfers a NodeJS binary and a binary library built by Microsoft that must be patched to be used on NixOS.

Prior to April 2021, this could simply be done by replacing .vscode-server/bin/*/node with nodejs-12_x; after April 2021, there is also a library module that is not compatible with nodejs-12_x. Therefore, it is necessary to patch these two ELF files.

What happens if you just replace nodejs (the pre-April solution from nixos.wiki)

@swdunlop
swdunlop / main.go
Created November 28, 2019 05:45
Simple Time Server Using GQLGen
package main
import (
"context"
"net/http"
"strings"
"time"
"github.com/99designs/gqlgen/handler"
)
@swdunlop
swdunlop / kasugano.sublime-color-scheme
Last active April 29, 2019 20:59
Kasugano Colors for Sublime Text 3
// scope reference: https://www.sublimetext.com/docs/3/scope_naming.html
{ "name": "Kasugano Color Scheme"
, "variables":
{ "comment": "#707070"
, "keyword": "#95A7CC"
, "entity": "#EDEFF2"
, "invalid": "#899AFF"
, "reserved": "#7882BF"
, "constant": "#899AFF"
, "string": "#98C9BB"
@swdunlop
swdunlop / kasugano.itermcolors
Created January 20, 2019 19:32
Kasugano Colors for ITerm
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.23828125</real>
@swdunlop
swdunlop / default.nix
Created December 18, 2018 18:14
Packaging saml2aws for Nix
# to install:
# nix-env -f default.nix -i
with import <nixpkgs> {};
buildGoPackage rec {
name = "saml2aws-${version}";
meta = {
description = "CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP";
homepage = "https://github.com/Versent/saml2aws";
license = lib.licenses.mit;
};
@swdunlop
swdunlop / fzf.fish
Created November 15, 2018 22:25
A few Fish functions for browsing files using FZF, Highlight and RipGrep
#!/usr/bin/env fish
function fzf-files
fzf \
--header 'Enter to open in Sublime, ctrl-y to copy path' \
--bind 'enter:execute-silent:subl {}' \
--bind 'ctrl-y:execute-silent:echo {} | pbcopy' \
--preview 'highlight -O xterm256 -s darkbone -l {} 2>/dev/null ||
cat {}'
end
@swdunlop
swdunlop / iterm
Last active March 27, 2018 19:12
Split the Current iTerm2 Session to Run a Command
#!/usr/bin/osascript
on run argv
tell application "iTerm2"
tell current session of current window
set view to split horizontally with default profile command "sh -c " & (quoted form of item 1 of argv)
select view
end tell
end tell
end run
@swdunlop
swdunlop / factor-git.diff
Created March 28, 2016 17:01
A patch for updating factor-git pkgbuild to work as of 2016-03-28
diff --git a/PKGBUILD b/PKGBUILD
index cfb5e4b..b2f3b03 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
# Contributor: Leonidas <[email protected]>
pkgname=factor-git
_pkgname=factor
-pkgver=0.96.1139.g3a9f4ed
+pkgver=0.96.3482.g676168c