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::str::FromStr; | |
#[derive(Debug, PartialEq, Eq, EnumString)] | |
enum ApiMethod { | |
GetState, | |
SetLocale, | |
} | |
impl TryFrom<&str> for ApiMethod { | |
.. | |
fn from(s: &str) -> Result<Self, Err> { |
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
DAPP_NAME="${1}" | |
export DFX_NETWORK | |
export DAPP_NAME | |
jq -r '.networks[env.DFX_NETWORK].config.HOST' dfx.json | awk -F '://' -v canister_id="$(jq -r .[env.DAPP_NAME][env.DFX_NETWORK] canister_ids.json)" '{print $1 FS "." canister_id $2}' |
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 -euo pipefail | |
: Move to the repo root, assuming this is installed at ./scripts/dfx-start-join | |
cd "$(dirname "$(realpath "$0")")/.." | |
help_text() { | |
cat <<-EOF | |
Joins an existing locally running dfx server. |
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
git ls-files --recurse-submodules --full-name |\ | |
awk -F/ '($(NF) == ".gitignore")' |\ | |
xargs -I{} awk -vx="{}" 'BEGIN{gsub(/[.]gitignore$/,"", x)}/^ *#/{print;next}/./{print x$0}' "{}" |\ | |
awk 'BEGIN{print ".git"}{print}' |
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
set -eux | |
user="$1" | |
github_user="$2" | |
mkdir -p "users" | |
rm -fr "users/${user}" | |
cp -R /etc/skel "users/${user}" | |
mkdir -p "users/${user}/.ssh" | |
chmod 700 "users/${user}/.ssh" | |
curl --fail "https://github.com/${github_user}.keys" > "users/${user}/.ssh/authorized_keys2" |
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
on: [push, pull_request] | |
name: Code Coverage | |
jobs: | |
tarpaulin: | |
name: Rust Tarpaulin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 |
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
set -eu | |
touch ,logtimes | |
FLAGS="${FLAGS:-}" | |
all_tests_with_dummy_times() { | |
set -x | |
cargo test $FLAGS -- --list --format terse | awk '/: test/{print "0s", "new", substr($1, 1, length($1)-1)}' | |
} | |
test_times() { |
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
#!/bin/bash | |
set -euo pipefail | |
COMMIT_MESSAGE="$(head -n1 "$1")" | |
echo "$COMMIT_MESSAGE" | gawk ' | |
BEGIN{ | |
types["feat"]=0; | |
types["fix"]=0; | |
types["doc"]=0; | |
types["text"]=0; | |
types["style"]=0; |
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
# MAC=xx-xx-xx-xx-xx-xx | |
MAX_IDLE=10 | |
while true ; do | |
idle=$(/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}') | |
if (( idle < MAX_IDLE )) ; then | |
sleep $(( MAX_IDLE - idle + 1 )) | |
else | |
blueutil --inquiry 4 | grep -E "$MAC" || { | |
echo "Locking screen..." | |
pmset displaysleepnow |
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
dig +short @$(ipconfig getoption en0 server_identifier) google.com |
NewerOlder