This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object GhettoValidation { | |
implicit class Optionator[A](val a: A) extends AnyVal { | |
def iff(f: => Boolean): Option[A] = | |
if (f) Some(a) else None | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbtlatest() { | |
curl -s "https://github.com/sbt/sbt/releases/latest" | perl -pe 's/^.*href="(.*)".*$/$1/' | perl -pe 's/^.*tag\/v(.*).*$/$1/' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
let | |
cfg = config.mailserver; | |
backupUser = "tardis"; | |
dsyncBackupScript = "dsyncbackup.sh"; | |
set = cfg.loginAccounts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{self, Write}; | |
use std::process::{exit, Command, Stdio}; | |
use std::env; | |
fn main() { | |
main2().unwrap_or_else(|e| { | |
eprintln!("{}", e); | |
exit(1); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
TRASH="~/.local/share/Trash" | |
nix-collect-garbage -d | |
nix optimise-store | |
rm -rfv "$TRASH/*" | |
nixos-rebuild switch --repair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, ... }: | |
{ | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
./mount.nix | |
./dropbox.nix | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <ESP8266WiFiMulti.h> | |
#include <ESP8266HTTPClient.h> | |
#include <WiFiClientSecureBearSSL.h> | |
const uint8_t fingerprint[20] = {0xA3, 0xDE, 0xBD, 0xC9, 0x77, 0xE0, 0xDC, 0x68, 0x2F, 0x97, 0xB5, 0x59, 0xA0, 0xD0, 0x0A, 0x8E, 0x3B, 0xBA, 0x5C, 0xFC}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
let | |
python = pkgs.python3Packages.python; | |
in | |
{ | |
systemd.services.thermonitor = { | |
description = "Thermonitor Daemon"; | |
serviceConfig = { | |
ExecStart = "/home/phi/thermonitor.py"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{self, Write}; | |
use std::process::{exit, Command, Stdio}; | |
fn main() { | |
main_guarded().unwrap_or_else(|e| { | |
eprintln!("{}", e); | |
exit(1); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
// This script converts Maven dependencies from a pom.xml to sbt dependencies. | |
// It is based on the answers of George Pligor and Mike Slinn on http://stackoverflow.com/questions/15430346/ | |
// - install https://github.com/lihaoyi/Ammonite | |
// - make this script executable: chmod +x PomDependenciesToSbt | |
// - run it with from your shell (e.g bash): | |
// $ ./PomDependenciesToSbt /path/to/pom.xml | |
import scala.xml._ |