refactor: legacyPackages
This commit is contained in:
@@ -241,8 +241,6 @@ in {
|
||||
nvim-alias = pkgs.callPackage ./nvim-alias.nix {};
|
||||
bolt-unpack = pkgs.callPackage ./bolt-unpack.nix {};
|
||||
nvim-pager = pkgs.callPackage ./nvim-pager.nix {};
|
||||
printobstacle = pkgs.callPackage ./printobstacle.nix {};
|
||||
printprogress = pkgs.callPackage ./printprogress.nix {};
|
||||
colorize = pkgs.callPackage ./colorize.nix {};
|
||||
github-gh-tl = pkgs.callPackage ./github/gh-tl.nix {};
|
||||
supabase-with-env-collection = pkgs.callPackage ./supabase-with-env-collection.nix {};
|
||||
@@ -261,7 +259,7 @@ in {
|
||||
"sentinèlla" = pkgs.callPackage (./. + "/sentinèlla") {};
|
||||
shellplot = pkgs.callPackage ./shellplot {};
|
||||
sops = pkgs.callPackage ./sops.nix {};
|
||||
onlinepubs2man = pkgs.callPackage ./onlinepubs2man {};
|
||||
onlinepubs2man = pkgs.callPackage ./onlinepubs2man {};
|
||||
pg-17-ext-hemar = buildHemarExt pkgs "17";
|
||||
pg-17-ext-http = buildHttpExt pkgs "17";
|
||||
pg-17-ext-smtp-client = buildSmtpExt pkgs "17";
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{pkgs, ...}: let
|
||||
name = "printobstacle";
|
||||
in
|
||||
pkgs.writeShellScriptBin "${name}" ''
|
||||
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
|
||||
''
|
||||
@@ -1,6 +0,0 @@
|
||||
{pkgs, ...}: let
|
||||
name = "printprogress";
|
||||
in
|
||||
pkgs.writeShellScriptBin "${name}" ''
|
||||
printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}"
|
||||
''
|
||||
81
package/sentinèlla/base64.sh
Normal file
81
package/sentinèlla/base64.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
mod="${1:?}"
|
||||
|
||||
case "$mod" in
|
||||
encode)
|
||||
printf '%s' "${2:?}" | od -An -t u1 | tr -s ' ' | tr -d '\n' | awk '
|
||||
BEGIN {
|
||||
A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
}
|
||||
function dec2bin(n, r,len,pad) {
|
||||
if (n==0) return "00000000"
|
||||
while (n>0) {
|
||||
r = (n%2) r
|
||||
n = int(n/2)
|
||||
}
|
||||
return sprintf("%08s", r)
|
||||
}
|
||||
function bin2dec(s, i,d,r) {
|
||||
r=0
|
||||
for(i=1;i<=length(s);i++) {
|
||||
d=substr(s,i,1)
|
||||
r = r*2 + d
|
||||
}
|
||||
return r
|
||||
}
|
||||
function buildbin(t, r) {
|
||||
for(i=1;i<=NF;i+=1) {
|
||||
#printf("%s | %s\n", dec2bin($i), $i)
|
||||
r = sprintf("%s%s", r, dec2bin($i))
|
||||
}
|
||||
return r
|
||||
}
|
||||
function base64(b, r,c) {
|
||||
for(i=1;i<=length(b);i+=6) {
|
||||
#printf("%s | %s\n", substr(b,i,6), bin2dec(substr(b,i,6)))
|
||||
c = substr(A, bin2dec(substr(b,i,6))+1, 1)
|
||||
r = sprintf("%s%s", r, c)
|
||||
}
|
||||
return r
|
||||
}
|
||||
{
|
||||
b=buildbin($1)
|
||||
l=length(b)
|
||||
lack = (6 - l % 6) % 6
|
||||
for(i=1;i<=lack;i+=1) {
|
||||
b = sprintf("%s0", b)
|
||||
}
|
||||
r = base64(b)
|
||||
for(i=1;i<=lack/2;i+=1) {
|
||||
r = sprintf("%s=", r)
|
||||
}
|
||||
print r
|
||||
}
|
||||
'
|
||||
;;
|
||||
decode)
|
||||
printf '%b\n' "$(printf '%s' "${2:?}" | awk ' BEGIN {
|
||||
A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
}
|
||||
function dec2bin(n, r,len,pad) {
|
||||
if (n==0) return "000000"
|
||||
while (n>0) {
|
||||
r = (n%2) r
|
||||
n = int(n/2)
|
||||
}
|
||||
r = sprintf("%6s", r)
|
||||
gsub(/ /,"0",r)
|
||||
return r
|
||||
}
|
||||
{
|
||||
for(i=1;i<=length($1);i+=1) {
|
||||
b=sprintf("%s%s", b, dec2bin(index(A, substr($1,i,1))-1))
|
||||
}
|
||||
for(i=1; i<=length(b); i+=8){
|
||||
n=0
|
||||
for(j=0;j<8;j++) n = n*2 + (substr(b,i+j,1)=="1")
|
||||
printf "\\x%02X", n
|
||||
}
|
||||
}
|
||||
')"
|
||||
;;
|
||||
esac
|
||||
@@ -1,5 +1,11 @@
|
||||
{ symlinkJoin, writeShellApplication, socat, dash, hectic, curl }:
|
||||
let
|
||||
base64 = writeShellApplication {
|
||||
name = "base64";
|
||||
runtimeInputs = [ ];
|
||||
text = builtins.readFile ./base64.sh;
|
||||
};
|
||||
|
||||
# TODO: writeDashApplication
|
||||
probe = writeShellApplication {
|
||||
name = "probe";
|
||||
@@ -9,7 +15,7 @@ let
|
||||
|
||||
probe-loop = writeShellApplication {
|
||||
name = "probe-loop";
|
||||
runtimeInputs = [ ];
|
||||
runtimeInputs = [ base64 ];
|
||||
text = builtins.readFile ./probe-loop.sh;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,91 +11,6 @@
|
||||
# TIMEOUT=5
|
||||
# AUTH_FILE="/path/htpasswd-like" # lines: user:pass
|
||||
|
||||
base64() {
|
||||
local mod
|
||||
mod="${1:?}"
|
||||
|
||||
case "$mod" in
|
||||
encode)
|
||||
printf '%s' "${2:?}" | od -An -t u1 | tr -s ' ' | tr -d '\n' | awk '
|
||||
BEGIN {
|
||||
A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
}
|
||||
function dec2bin(n, r,len,pad) {
|
||||
if (n==0) return "00000000"
|
||||
while (n>0) {
|
||||
r = (n%2) r
|
||||
n = int(n/2)
|
||||
}
|
||||
return sprintf("%08s", r)
|
||||
}
|
||||
function bin2dec(s, i,d,r) {
|
||||
r=0
|
||||
for(i=1;i<=length(s);i++) {
|
||||
d=substr(s,i,1)
|
||||
r = r*2 + d
|
||||
}
|
||||
return r
|
||||
}
|
||||
function buildbin(t, r) {
|
||||
for(i=1;i<=NF;i+=1) {
|
||||
#printf("%s | %s\n", dec2bin($i), $i)
|
||||
r = sprintf("%s%s", r, dec2bin($i))
|
||||
}
|
||||
return r
|
||||
}
|
||||
function base64(b, r,c) {
|
||||
for(i=1;i<=length(b);i+=6) {
|
||||
#printf("%s | %s\n", substr(b,i,6), bin2dec(substr(b,i,6)))
|
||||
c = substr(A, bin2dec(substr(b,i,6))+1, 1)
|
||||
r = sprintf("%s%s", r, c)
|
||||
}
|
||||
return r
|
||||
}
|
||||
{
|
||||
b=buildbin($1)
|
||||
l=length(b)
|
||||
lack = (6 - l % 6) % 6
|
||||
for(i=1;i<=lack;i+=1) {
|
||||
b = sprintf("%s0", b)
|
||||
}
|
||||
r = base64(b)
|
||||
for(i=1;i<=lack/2;i+=1) {
|
||||
r = sprintf("%s=", r)
|
||||
}
|
||||
print r
|
||||
}
|
||||
'
|
||||
;;
|
||||
decode)
|
||||
printf '%b\n' "$(printf '%s' "${2:?}" | awk ' BEGIN {
|
||||
A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
}
|
||||
function dec2bin(n, r,len,pad) {
|
||||
if (n==0) return "000000"
|
||||
while (n>0) {
|
||||
r = (n%2) r
|
||||
n = int(n/2)
|
||||
}
|
||||
r = sprintf("%6s", r)
|
||||
gsub(/ /,"0",r)
|
||||
return r
|
||||
}
|
||||
{
|
||||
for(i=1;i<=length($1);i+=1) {
|
||||
b=sprintf("%s%s", b, dec2bin(index(A, substr($1,i,1))-1))
|
||||
}
|
||||
for(i=1; i<=length(b); i+=8){
|
||||
n=0
|
||||
for(j=0;j<8;j++) n = n*2 + (substr(b,i+j,1)=="1")
|
||||
printf "\\x%02X", n
|
||||
}
|
||||
}
|
||||
')"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
: "${TIMEOUT:=5}"
|
||||
: "${VOLUMES:=$(df -P | awk 'NR>1{print $6}')}"
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
#!/bin/dash
|
||||
|
||||
TOKEN=8448534574:AAEvsdQqhUDu3RVRJWDGIVeqRmXlB0Dqn1Q
|
||||
CHAT_ID=380055934
|
||||
POLLING_INTERVAL_SEC=${POLLING_INTERVAL_SEC:-3}
|
||||
|
||||
while true; do
|
||||
curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
|
||||
-d "chat_id=${CHAT_ID}" \
|
||||
-d text="your message"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user