Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
"""
Notify when 8 hours have passed since first login today
"""
import getpass
import subprocess
import time
from datetime import datetime, timezone, timedelta
# Instructions on how to build the owl OCaml scientific library (https://github.com/owlbarn/owl)
# Debian, Option 3: Pin the Dev-Repo, with distro's native OpenBLAS/LAPACKE packages
docker run --rm -it debian bash -eux -c 'apt-get update
# basic tools needed for opam to work:
apt-get install -y curl patch unzip make gcc bzip2 git
# we cannot automate running the install.sh from opam because it is interactive, instead we just download the opam binary:
curl -sL https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux --output /usr/local/bin/opam
chmod +x /usr/local/bin/opam
@gaborigloi
gaborigloi / GetVdiNbdServerInfo.java
Created October 12, 2017 08:46
Testing the VDI.get_nbd_info call in the Java XenServer / XenAPI SDK
/* To run: change https to http in TestBase.java, add it to RunTests.java, comment out the other tests,
run with:
java -cp :xmlrpc-client-3.1.3.jar:xmlrpc-common-3.1.3.jar:ws-commons-util-1.0.2.jar RunTests ...
*/
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@gaborigloi
gaborigloi / lwt_timeout_test.ml
Created August 2, 2017 08:28
OCaml demo showing that a timeout mechanism using Lwt cannot interrupt Unix.sleep
(* run with "ocaml lwt_timeout_test.ml" *)
#use "topfind";;
#require "unix";;
#require "lwt";;
#require "lwt.unix";;
open Lwt;;
let f = ref "";;
Lwt.pick [(Lwt_unix.sleep 4.0 >>= fun () -> f:= "slept 4 seconds"; return_unit); (Lwt_unix.sleep 2.0 >>= fun () -> f := "slept 2 seconds"; return_unit)] |> Lwt_main.run;;