Skip to content

Instantly share code, notes, and snippets.

@alyssais
alyssais / default.nix
Created May 24, 2019 10:42
nix-gemspec
{ stdenv, lib, makeWrapper, bundler, bundix, ruby }:
stdenv.mkDerivation {
name = "nix-gemspec";
src = ./.;
buildInputs = [ makeWrapper ruby ];
installPhase = ''
install -D -m755 nix-gemspec.rb $out/bin/nix-gemspec
patchShebangs $out/bin/nix-gemspec
@alyssais
alyssais / default.nix
Created January 22, 2019 11:32
Nix expression for building a reveal.js presentation using pandoc.
{ pkgs ? import (builtins.fetchTarball {
# nixpkgs-unstable 2019-01-22
url = https://github.com/NixOS/nixpkgs/archive/a5de41088031e6d3d4f799ef3964317a74e72169.tar.gz;
sha256 = "0ycsai65dbcwmns36a0pkxpsgpl86q273c27ag80nijfb1w88201";
}) {}
, revealjs ? pkgs.fetchFromGitHub {
owner = "hakimel";
repo = "reveal.js";
rev = "3.7.0";
{ pkgs, ... }:
{
security.acme.certs."qyliss.net" = {
email = "hi@alyssa.is";
postRun = "systemctl reload nginx.service";
webroot = "/var/lib/acme/acme-challenge";
};
services.nginx.enable = true;
{ ... }:
{
launchd.user.agents.dnscrypt-proxy = {
serviceConfig.RunAtLoad = true;
serviceConfig.KeepAlive = true;
serviceConfig.ProgramArguments = [
"${pkgs.dnscrypt-proxy2}/bin/dnscrypt-proxy"
"-config"
(toString (pkgs.writeText "dnscrypt-proxy.toml" ''
@alyssais
alyssais / networking.nix
Last active October 29, 2018 10:01
Featuring DNS over HTTPS and plausible MAC randomisation
{ pkgs, ... }:
{
networking.networkmanager.enable = true;
networking.networkmanager.ethernet.macAddress = "random";
networking.networkmanager.wifi.macAddress = "random";
networking.networkmanager.extraConfig = ''
[connection-extra]
ethernet.generate-mac-address-mask=FE:FF:FF:00:00:00
wifi.generate-mac-address-mask=FE:FF:FF:00:00:00
@alyssais
alyssais / key
Created September 16, 2018 12:47
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBK6xI1vfSCrhGzxUylT/+nHT5Yq9XPjSssgGmtmsZeO
@alyssais
alyssais / vpn
Created May 8, 2018 17:12
A tiny command line interface to Viscosity
#!/usr/bin/env bash
run_list() {
osascript <<OSA
tell application "Viscosity"
repeat with theConnection in connections
set theName to name of theConnection
set theState to state of theConnection
log theName & ": " & theState
end repeat
@alyssais
alyssais / dnsmasq.conf
Last active April 6, 2022 11:33
Use .localhost domains for Rails apps
address=/.localhost/127.0.0.1
address=/.test/127.0.0.1
address=/.lvh.me/127.0.0.1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
My Signal fingerprint: 20273 47553 69079 98765 30821 08445
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEENgEcZvPSC1GwnS7FbPBk0Unjq9sFAlq5ZTQACgkQbPBk0Unj
q9tW5Q/+JbvJjfjM3/00oaVlyVTG9KTkezSBeNoVH38Pz1SIoqw2Kq03F3xLTPnL
UzOz2LD7e6F0f2brDnf1GKnbUp0TSmtbG/QQhJizDCu51QegctccUxLPEvDZ+w2M
KgLfisimvERlIDhI5wBYBme/eemu21viaeriRN3T89zuK0MIlaWZamB9upmswzRf
@alyssais
alyssais / thread.rb
Created March 23, 2018 10:53
My really hacky livetweeting script. You pass in the ID of the tweet to continue the thread from.
require "yaml"
require "twitter"
config = YAML.load_file(File.expand_path("~/.trc")).dig("profiles", "qyliss").each_value.first
last_status = ARGV.fetch(0)
twitter = Twitter::REST::Client.new do |t|
t.consumer_key = config.fetch("consumer_key")
t.consumer_secret = config.fetch("consumer_secret")