Skip to content

Instantly share code, notes, and snippets.

Avatar
☄️
😩

jordan w4

☄️
😩
View GitHub Profile
View teleport.nix
{ pkgs ? import <nixpkgs> { } }:
let
version = "11.1.4";
sha256 = "1nnz2lk6svmdpia6qsahdrh4imapwgq9w4nq28z5r2gvx9p30n71";
teleportPackage = pkgs.stdenv.mkDerivation rec {
pname = "teleport";
inherit version;
src = fetchTarball {
inherit sha256;
@w4
w4 / default.nix
Created December 11, 2022 16:30
Reproducable dnscontrol config builds using Nix
View default.nix
{ pkgs ? import <nixpkgs> { } }:
pkgs.stdenv.mkDerivation rec {
name = "dnsconfig";
version = "0.1.0";
phases = [ "buildPhase" "testPhase" ];
src = ./config;
buildPhase = ''
@w4
w4 / Containerfile
Last active October 3, 2022 10:17
Download, build and install Teleport for Podman on ARM64 NixOS
View Containerfile
ARG VERSION
FROM ubuntu AS download
ARG DEBIAN_FRONTEND=noninteractive
ARG VERSION
WORKDIR /tmp
RUN apt update && apt install -y curl
RUN curl -o teleport.tar.gz https://get.gravitational.com/teleport-v$VERSION-linux-arm64-bin.tar.gz \
&& tar xvzf teleport.tar.gz
View ingest-juniper-security-logs.nix
{ config, pkgs, lib, ... }:
{
containers.grafana = {
autoStart = true;
ephemeral = true;
bindMounts = {
"/data" = {
hostPath = "/data/random/grafana";
isReadOnly = false;
};
@w4
w4 / vault-crtlist-generator.py
Last active March 10, 2022 02:46
Call LetsEncrypt via vault-acme for a list of domains to generate SSL certificates and create a HAProxy crtlist (and NixOS container to run it)
View vault-crtlist-generator.py
import requests
import json
import logging
import os
separator = '-------------------------------------------------------'
logging.basicConfig(format='%(levelname_brackets)s %(message)s', level=logging.INFO)
old_factory = logging.getLogRecordFactory()
def record_factory(*args, **kwargs):
@w4
w4 / Cargo.toml
Last active January 9, 2022 17:11
spotify playlist scraper (api-based)
View Cargo.toml
[package]
name = "spotify-playlist-scraper"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rspotify = { version = "0.11.3", features = ["cli"] }
futures = "0.3.19"
View 0001-Use-CSS-styles-for-syntax-highlighting.patch
From a5f4c545e231d76226497b938baf0b9d7747584b Mon Sep 17 00:00:00 2001
From: "jordan@doyle.la" <jordan@doyle.la>
Date: Fri, 7 Aug 2020 17:21:17 +0100
Subject: [PATCH] Use CSS styles for syntax highlighting
---
Cargo.lock | 6 +++---
Cargo.toml | 2 +-
src/highlight.rs | 26 +++++++++++++-------------
src/main.rs | 9 ++++++++-
View sync-public-repos.sh
#!/usr/bin/env bash
CURR_DIR="$(pwd)"
for dir in /share/git/pub/*; do
cd "$dir"
RET=$(git remote get-url github+w4 > /dev/null; echo $?)
if [[ $RET -ne 0 ]]; then
echo "not in git: $dir"
continue
fi
echo "$dir:"
@w4
w4 / koselig.diff
Created May 5, 2018 19:02
koselig diff
View koselig.diff
diff --git a/.env.example b/.env.example
index ec44a125..dbc3c70a 100644
--- a/.env.example
+++ b/.env.example
@@ -7,14 +7,16 @@ APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
@w4
w4 / build_hosts.py
Last active January 22, 2020 15:28
Build a host file from a dhcp.leases file
View build_hosts.py
# This is a simple little script for parsing dhcpd.leases files and
# returning a hosts file for them.
# on DNS server: */5 * * * * curl http://10.0.0.1:4400/ -o /etc/dhcp_hosts
from http.server import BaseHTTPRequestHandler, HTTPServer
import re
from ipaddress import ip_network, ip_address
class S(BaseHTTPRequestHandler):