Skip to content

Instantly share code, notes, and snippets.

David Udelson dudelson

Block or report user

Report or block dudelson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dudelson
dudelson / cyberark-slides.org
Last active Jan 29, 2020
Slides for my presentation at CyberArk
View keybase.md

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 Nov 21, 2017
Illustration of functors in ocaml and comparison to functions
View functors.ml
(* 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 Jun 19, 2017
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
View minimal-webmachine-example.ml
(** 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 Jun 14, 2017
Hook to update awesomewm battery widget
View update-awesomewm-battery-widget.sh
#!/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 Jun 14, 2017
Script to toggle airplane mode on my laptop
View toggle_airplane_mode
#!/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"
View configure_dotfiles
#!/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 Jan 11, 2017
My dotfile configuration (system meta-configuration?) for my laptop
View dotfiles.yaml
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 Jan 9, 2017
The git pre-commit hook for my website. Responsible for building my blog archives and updating the "Last updated" info in the footer.
View website-pre-commit.sh
#!/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 \
@dudelson
dudelson / uva_10920_passing.cpp
Created Jan 8, 2017
My (passing) solution to UVA 10920
View uva_10920_passing.cpp
#include <iostream>
using namespace std;
typedef long long ll;
ll size, p, x, y;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
You can’t perform that action at this time.