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 <cstdio> | |
#include <iostream> | |
#include <vector> | |
static const int BUFFER_READ_SIZE = 8; | |
static const int MAX_READ_SIZE = 4 * 1024 * 1024; // 4MiB | |
int main() { | |
std::vector<char> echoData; | |
char stdinBuffer[BUFFER_READ_SIZE]; |
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 | |
DEFAULT_SUBJECT_PREFIX=${DEFAULT_SUBJECT_PREFIX:-"/C=CA/ST=Ontario/L=Kitchener/O=jskw"} | |
DEFAULT_KEY_TYPE="${DEFAULT_KEY_TYPE:-ec:prime256v1.pem}" | |
openssl ecparam -name prime256v1 > prime256v1.pem | |
log() { | |
# cowsay if available | |
if which cowsay > /dev/null ; then | |
echo "" |
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 | |
# | |
# Create container with the following command: | |
docker run \ | |
-d \ | |
-e TZ=America/Toronto \ | |
-v $PWD/data:/home/node/.webthings \ | |
--log-opt max-size=1m \ | |
--log-opt max-file=10 \ |
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 | |
DAYS_BEFORE_EMAIL=21 | |
TO_ADDR="Joe <joe@example.com>" | |
BCC_ADDR="Demo <demo@example.com>" | |
find ~/.acme.sh -name '*cer' | tee certs_to_check.txt | |
# usage $0 {NEW_CERT} {OLD_CERT} |
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
# https://adventofcode.com/2020/day/2 part 2 in jq | |
# Invoked with jq --raw-input --slurp --from-file aoc2.jq input.2.txt | |
# x ^ y | |
def xor($x;$y): | |
($x or $y) # Either $x or $y | |
and # but | |
($x and $y | not) # not both | |
; |
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
# Make a neato jq filter that just gives us question and answer sections. | |
JQ_FILTER='.[].message.response_message_data | [.QUESTION_SECTION[], ( .ANSWER_SECTION[]? | split(" ")[-1])]' | |
# What are my name servers for each of these? | |
for domain in jskw jsteel jsteelkw ; do for tld in ca dev ; do dig ${domain}.${tld} +yaml -tns | yq $JQ_FILTER ; done ; done # SHOW NS | |
[ | |
"jskw.ca. IN NS", | |
"ns-cloud-c4.googledomains.com.", | |
"ns-cloud-c3.googledomains.com.", | |
"ns-cloud-c2.googledomains.com.", |
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 | |
# Need a recent openssl to use -6 option (sha512). Either update openssl or change to -1 or similar if it doesn't work | |
shuf -n30 /usr/share/dict/words | tr '\n' ' ' | fold -s -w 48 | tr ' ' ';' | openssl passwd -6 -noverify -table -stdin | |
# Example Output: | |
#carrotwood;sacerdotalist;unfallible;homeliness; $6$xGj40hGX9L0NyToC$hqPn25jIFzS2vzfEVpsmzbDe3XeXtUkTJPHKBO7SI6FTkub4gqUWq5dpB8wfqkEoQClTmWkuiuN8K8eYIcfXL1 | |
#schoolteaching;moule;malesherbiaceous; $6$//mFpIknpKEToVt1$cyNLuPOsvPCW5KzJiS86rKKfonl8PBG0B/Xf5bLwiEvdcm64OX0jqwbhIxjOjrTejxUcB0ys.B0kdBLasb8l/. | |
#hypsophonous;ungroundedness;did;sapek; $6$NA29jYnRwQ1Tstlh$AW0NoJSKXCIiBo86FB9TKmD0aS67fcdtc.x8.VjeGgj287EuREkDWRmh/cxArFs8rGSM5eDPVC0kYyn52DlpX0 | |
#strepsinema;Thackerayana;camelman; $6$tze4YcdZgPo6e18o$PtsCCwvbkEuvfQoOnPH8ZErQeoGE8/PQvOhdkYioP687ZAujRbtK.IpKLSfVPM6tvsTkN9Z1qjrbssioezG1S. | |
#amyelencephalia;creeded;city;Triodon;oosporic; $6$Jh/vWDP3BM5Wah/X$CVfCUvFVVXQRBdGPo0x8YiIlLm0mm/4uadaHP39tCITxij8T98HMtVD9khCrVce0D.7AaC1cetiOlX/BF3IG.. |
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
/* | |
* Sending an email using kotlin and javax.mail | |
* | |
* Usage: java -jar app.jar <user> <password> <from> <to> <cc> | |
*/ | |
package main.kotlin.sendmail | |
import java.util.* | |
import javax.mail.* | |
import javax.mail.internet.* |
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 | |
FILTER_YUBIKEY='/Yubikey/{print;getline;getline;print;getline;print}' | |
EXPECTED_YUBI_MD5="1a067fac7f6915a0acd5a235876fd33e" # Hash of USB Device | |
LONG_POLL_TIME=3 # Poll time after locking | |
SHORT_POLL_TIME=1 # Poll time while waiting for yubikey to disconnect | |
ARMED=0 | |
DATESTRING=%Y-%m-%d\ %H:%M:%S.000 | |
do_screen_saver() { | |
echo "`date \"+${DATESTRING}\"` locking screen" |
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 | |
DUCKPATH=~/duckdns | |
TOKEN=changeme | |
DOMAINS=steelcomputers | |
curl -sSv "https://www.duckdns.org/update?domains=${DOMAINS}&token=${TOKEN}&ip=" \ | |
2>> ${DUCKPATH}/stderr.log \ | |
>> ${DUCKPATH}/stdout.log | |
printf ' - ' >> ${DUCKPATH}/stdout.log | |
date >> ${DUCKPATH}/stdout.log |