Skip to content

Instantly share code, notes, and snippets.

@dudelson
dudelson / food-label.html
Created March 26, 2023 19:34
Food label mini-project to practice CSS grid
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>Food Label Mini-Project</title>
</head>
<body class="m-4">
@dudelson
dudelson / cyberark-slides.org
Last active January 29, 2020 04:05
Slides for my presentation at CyberArk

URL Shortener

Keybase proof

I hereby claim:

  • I am dudelson on github.
  • I am dudelson (https://keybase.io/dudelson) on keybase.
  • I have a public key ASCFukV2GZLN1gqrjyLuW37sEpa60iK_s-P95FRNz_fKkgo

To claim this, I am signing this object:

@dudelson
dudelson / functors.ml
Created November 21, 2017 21:18
Illustration of functors in ocaml and comparison to functions
(* Basic demonstration of how to create and use functors,
* as well as how they parallel functions *)
(* Here are the two (equivalent) ways to define a function *)
let f x = x + 1
let g = fun x -> x + 1
(* The functor has the same two syntaxes as the function, except whereas a
* function takes one or more 'expressions' (each of which has a 'type') and
@dudelson
dudelson / minimal-webmachine-example.ml
Created June 19, 2017 20:57
A minimal example of how to use ocaml-webmachine to build a REST API. This API returns HTTP error 406 ("Not Acceptable") for every valid request
(** Returns http error 406 for every valid request.
build with: `ocamlbuild -use-ocamlfind -pkgs cohttp.lwt,lwt,webmachine main.byte` *)
open Cohttp
open Cohttp_lwt_unix
open Lwt.Infix
module Wm = struct
include Webmachine.Make(Cohttp_lwt_unix_io)
module Rd = Webmachine.Rd
end
@dudelson
dudelson / update-awesomewm-battery-widget.sh
Created June 14, 2017 05:12
Hook to update awesomewm battery widget
#!/usr/bin/env bash
export XAUTHORITY=/home/david/.Xauthority
export DISPLAY=:0
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
/usr/bin/awesome-client "local beautiful = require('beautiful'); beautiful.update_battery_widget()"
@dudelson
dudelson / toggle_airplane_mode
Created June 14, 2017 05:09
Script to toggle airplane mode on my laptop
#!/bin/sh
# toggles airplane mode
if [ ! -d /sys/class/leds/tuxedo::airplane ]; then
echo "ERROR: Cannot enable airplane mode without tuxedo-wmi kernel module."
echo "Please make sure the module is loaded and try again"
exit 1
fi
airplane_mode_led="/sys/class/leds/tuxedo::airplane/brightness"
#!/usr/bin/env python
'''
This script is run after user login. It parses my dotfile config
(~/.config/dotfiles.yml), and sets environment variables which my other
dotfiles can read in order to be informed of the options I want set.
This script only works with python 3.
'''
import os, subprocess
@dudelson
dudelson / dotfiles.yaml
Created January 11, 2017 04:58
My dotfile configuration (system meta-configuration?) for my laptop
monitors: [eDP1]
monitor_resolution_x: 1920
monitor_resolution_y: 1080
application_layout:
terminal: [1, 1]
browser: [1, 2]
emacs: [1, 3]
telegram: [1, 8]
@dudelson
dudelson / website-pre-commit.sh
Created January 9, 2017 04:35
The git pre-commit hook for my website. Responsible for building my blog archives and updating the "Last updated" info in the footer.
#!/usr/bin/sh
# this line is necessary to get the script to run in magit
PATH=$PATH:~/.gem/ruby/2.3.0/bin
echo "Running jekyll pre-build..." \
&& bundle exec jekyll build \
&& echo "Generating archives..." \
&& ruby blog/archive/_generator.rb \
&& git add blog/archive/dates blog/archive/tags \