Skip to content

Instantly share code, notes, and snippets.

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;
@trevorc
trevorc / ping_server.sh
Created October 26, 2017 16:03
Find closest server
#!/bin/sh
set -eu
count=$1
server=$2
latency=$(ping -nqc${count} ${server} |
sed -nE 's,^round[^=]*=[^/]*/([[:digit:]]+\.[[:digit:]]+).*,\1,p')
echo "${latency} ${server}"
@trevorc
trevorc / keybase.md
Created May 14, 2018 20:01
Keybase proof

Keybase proof

I hereby claim:

  • I am trevorc on github.
  • I am toc (https://keybase.io/toc) on keybase.
  • I have a public key ASBMnVMcKtYb0Z1Q7WqbxqLRANTY5lPzmZqDjiCZiE1y8Ao

To claim this, I am signing this object:

/*
* Copyright (c) 2020-2021 Trevor Caira
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*