Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# This is scheduled in CRON. It will run every 20 minutes
# and check for inactivity. It compares the RX and TX packets
# from 20 minutes ago to detect if they significantly increased.
# If they haven't, it will force the system to sleep.
#
log=~/scripts/idle/log
let emit_seats action =
let module Html5 = Html5.M in
match action with
| Container.Updated _ ->
[{Container.selector="#content";
markup = <:html5< <div>didnotgetit</div> >> }]
| _ ->
[{Container.selector="#error";
markup = <:html5< <div>didnotgetit</div> >> }]
------------------------------------------------------------------------
{stdenv, buildOcaml, fetchurl}:
buildOcaml rec {
minimumSupportedOcamlVersion = "4.02";
version = "109.35.02";
name = "herelib";
src = fetchurl {
url = "https://github.com/janestreet/herelib/archive/${version}.tar.gz";
sha256 = "7f8394169cb63f6d41e91c9affa1b8ec240d5f6e9dfeda3fbb611df521d4b05a";
@ericbmerritt
ericbmerritt / herelib.nix
Last active August 29, 2015 14:21
buildOcaml.nix
{ stdenv, ocaml, findlib, camlp4 }:
{ name, version, buildInputs ? [],
createFindlibDestdir ? true,
dontStrip ? true,
minimumSupportedOcamlVersion ? null,
meta ? {}, ...
}@args:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
let exec
: log:Nixy_log.t -> ?working_dir:String.t -> ('a, unit, string, 'ret) format4 ->
(Unit.t, Exn.t) Deferred.Result.t =
fun ~log ?working_dir shcmd ->
Async_shell.sh_lines_stream ?working_dir shcmd
>>= fun stream ->
Monitor.try_with (fun () -> log_stream log stream)
-----------------
--- admin/awscli ‹master* M?› » nix-env -i awscli
replacing old ‘awscli-1.7.29’
installing ‘awscli-1.7.32’
these derivations will be built:
/nix/store/5ma5ba64la0lsfxmv9kxf5k6l37cnxkc-1.7.32.tar.gz.drv
/nix/store/88n4y5ci56d18n59nc3mvlrrdl3lx8q0-awscli-1.7.32.drv
building path(s) ‘/nix/store/1sia0z2hkp71qjbnz9d8iq3lz50zlgjm-1.7.32.tar.gz’
trying https://github.com/aws/aws-cli/archive/1.7.32.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
{ stdenv, fetchzip, pythonPackages, groff }:
pythonPackages.buildPythonPackage rec {
name = "awscli-${version}";
version = "1.7.32";
namePrefix = "";
src = fetchzip {
url = "https://github.com/aws/aws-cli/archive/${version}.tar.gz";
sha256 = "0qly1bcfpzj19vw20qwfp9dxc12l829qi5qj9zik0nkcr3gf02d6";
@ericbmerritt
ericbmerritt / nixy.ml
Created June 15, 2015 18:47
Error Problems in module definition
open Core.Std
open Core_extended.Std
open Async.Std
open Deferred.Result.Monad_infix
module Log = Nixy_log.Make(Nixy_log.Syslog)
module Config = Config.Make(Log)
module Default =
struct
module Log : Nixy_log.S
type error = [ `Config_failure of String.t
| `Config_doesnt_exist of String.t
| `Read_exception of Exn.t ] with sexp
type github_info = {owner: String.t; username: String.t; token: String.t} with sexp
{ok, RawCDs} = core_cds:find_all(),
FilteredCDs = lists:filter(fun(CD) ->
Now = date(),
case ecdm_cd:maturity_date(CD) of
undefined ->
true;
Value when Value < Now ->
true;
_ ->