Skip to content

Instantly share code, notes, and snippets.

View Opa-'s full-sized avatar
😼

Opa Opa-

😼
View GitHub Profile
@Opa-
Opa- / endlessh-winner.sh
Last active February 27, 2024 15:26
endlessh winner table
#!/bin/bash
TOP=$(journalctl -u endlessh.service | grep "time=" | awk '{split($11, time, "="); split($8, ip, ":"); print ip[4], time[2]}' | awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}' | sort -n -k2)
format_duration() {
local seconds=$(printf "%.3f" $1) # Convert seconds to 3 decimal places
local milliseconds=$(echo "scale=0; $seconds * 1000" | bc) # Convert seconds to milliseconds
local milliseconds=${milliseconds%.*} # Remove decimal part
# Calculate days, hours, minutes, and seconds
@Opa-
Opa- / bitwarden.fish
Created December 18, 2024 10:53
How to use Bitwarden CLI with macOS Touch ID (Fish)
set -x BW_USER '<YOUR-USER>'
function bw
set bw_exec (which bw)
set -x NODE_OPTIONS --no-deprecation
set -g bw_session_file '/var/root/.bitwarden.session'
set -g err_token_not_found "Token not found, please run bw --regenerate-session-key"
function _read_token_from_file
switch $argv[1]