diff options
-rwxr-xr-x | bin/ak-articles | 141 | ||||
-rwxr-xr-x | bin/ak-calculate-size (renamed from bin/calculate-size) | 0 | ||||
-rwxr-xr-x | bin/ak-categories | 141 | ||||
-rwxr-xr-x | bin/ak-clean (renamed from bin/clean) | 0 | ||||
-rwxr-xr-x | bin/ak-comments (renamed from bin/comments) | 0 | ||||
-rwxr-xr-x | bin/ak-config (renamed from bin/akconfig) | 0 | ||||
-rwxr-xr-x | bin/ak-enter (renamed from bin/enter) | 0 | ||||
-rwxr-xr-x | bin/ak-extract-cids (renamed from bin/extract-cids) | 0 | ||||
-rw-r--r-- | bin/ak-file.c | 27 | ||||
-rwxr-xr-x | bin/ak-filejoiner (renamed from bin/filejoiner) | 0 | ||||
-rwxr-xr-x | bin/ak-filesplitter (renamed from bin/filesplitter) | 0 | ||||
-rwxr-xr-x | bin/ak-find-latest-mined-sblock | 76 | ||||
-rwxr-xr-x | bin/ak-follow (renamed from bin/follow) | 0 | ||||
-rwxr-xr-x | bin/ak-following (renamed from bin/following) | 0 | ||||
-rwxr-xr-x | bin/ak-get-akid | 5 | ||||
-rwxr-xr-x | bin/ak-get-chain-minified | 1 | ||||
-rwxr-xr-x | bin/ak-get-gpg | 2 | ||||
-rwxr-xr-x | bin/ak-get-ipfs-hashes-from-my-zchain | 2 | ||||
-rwxr-xr-x | bin/ak-get-latest (renamed from bin/get-latest) | 0 | ||||
-rwxr-xr-x | bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain | 8 | ||||
-rwxr-xr-x | bin/ak-get-only-ipfs-key-values-from-our-zchain | 3 | ||||
-rwxr-xr-x | bin/ak-ipfs-check (renamed from bin/ipfs-check) | 0 | ||||
-rwxr-xr-x | bin/ak-ipfs-starter (renamed from bin/ipfs-starter) | 0 | ||||
-rwxr-xr-x | bin/ak-ipns-resolve (renamed from bin/ipns-resolve) | 0 | ||||
-rwxr-xr-x | bin/ak-json2bash (renamed from bin/json2bash) | 0 | ||||
-rwxr-xr-x | bin/ak-logfollow (renamed from bin/logfollow) | 0 | ||||
-rwxr-xr-x | bin/ak-logthis (renamed from bin/logthis) | 0 | ||||
-rwxr-xr-x | bin/ak-mempool | 19 | ||||
-rwxr-xr-x[-rw-r--r--] | bin/ak-miner-script (renamed from miner-script-prototype.sh) | 0 | ||||
-rwxr-xr-x | bin/ak-mixtapes (renamed from bin/mixtapes) | 0 | ||||
-rwxr-xr-x | bin/ak-network | 5 | ||||
-rwxr-xr-x | bin/ak-news (renamed from bin/news) | 0 | ||||
-rwxr-xr-x | bin/ak-pack_z_block (renamed from bin/pack_z_block) | 0 | ||||
-rwxr-xr-x | bin/ak-profile (renamed from bin/profile) | 0 | ||||
-rwxr-xr-x | bin/ak-reference (renamed from bin/reference) | 0 | ||||
-rwxr-xr-x | bin/ak-repositories (renamed from bin/repositories) | 0 | ||||
-rwxr-xr-x | bin/ak-roadmap | 32 | ||||
-rwxr-xr-x | bin/ak-show_sblock | 9 | ||||
-rwxr-xr-x | bin/ak-tempassin (renamed from bin/tempassin) | 0 | ||||
-rwxr-xr-x | bin/ak-todos | 140 | ||||
-rwxr-xr-x | bin/ak-transactions | 50 | ||||
-rwxr-xr-x | bin/ak-unfollow (renamed from bin/unfollow) | 0 | ||||
-rwxr-xr-x | bin/ak-zblock-manipulator | 140 | ||||
-rwxr-xr-x | bin/ak-zchain-chk (renamed from bin/zchain-chk) | 0 | ||||
-rwxr-xr-x | bin/ak-zchain-rebase (renamed from bin/zchain-rebase) | 0 | ||||
-rwxr-xr-x | bin/ak-zchain-reset (renamed from bin/zchain-reset) | 0 | ||||
-rwxr-xr-x | bin/ak2html | 45 | ||||
-rwxr-xr-x | config.sh | 40 | ||||
-rwxr-xr-x | init.sh | 38 | ||||
-rwxr-xr-x | install.sh | 2 | ||||
-rwxr-xr-x | ipfs-check-install-setup-init-update | 4 |
51 files changed, 888 insertions, 42 deletions
diff --git a/bin/ak-articles b/bin/ak-articles new file mode 100755 index 0000000..18959ad --- /dev/null +++ b/bin/ak-articles @@ -0,0 +1,141 @@ +#!/bin/bash +ZARTICLESDIR="$WORKDIR/articles" +TEMP="/tmp/aktmp" +echo $ZARTICLESDIR +if [ ! -d $ZARTICLESDIR ]; then + mkdir $ZARTICLESDIR + cd $ZARTICLESDIR + git init + echo "Articles repository" > README + echo "Qmetc" >> README + git add README + git commit -m "Initiated articles repository" + echo "zarticlesdir created along with git repo" +else + echo "zarticlesdir found" +fi +tempassin(){ + if [ ! -z $1 ] + then + TEMPASSIN="$1" + else + TIMESTAMP="$(date -u +%s)" + TEMPASSIN="/tmp/aktmp_$TIMESTAMP" + fi + if [ ! -d $TEMPASSIN ]; then + mkdir $TEMPASSIN + fi + cd $TEMPASSIN +} +create(){ + tempassin $TEMP + pwd + export ARTICLES_FILE="$(date +%Y%m%d_%H%M%S)" + vi $ARTICLES_FILE + echo "Renaming..." + TITLE="$(head -n 1 $ARTICLES_FILE)" + TO_FILE=$ARTICLES_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) + IPFS_FILE=$(ipfs add -q $ARTICLES_FILE) + mv $ARTICLES_FILE $ZARTICLESDIR/$TO_FILE + sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZARTICLESDIR/README + add $ZARTICLESDIR/$TO_FILE + echo "Adding to git repo..." + cd $ZARTICLESDIR + git add $TO_FILE README + git commit -m "Added $TO_FILE with $(head -n 1 $ZARTICLESDIR/$TO_FILE)" + git clean --force + # rm -rf $TEMP +} +index(){ + FILES="$(ls -1 $ZARTICLESDIR)" + i=0 + for FILE in $FILES + do + DATE=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') + TITLE=$(head -n 1 $ZARTICLESDIR/$FILE) + echo $i \| $DATE \| $TITLE + let i+=1 + done +} +title(){ + echo ak-articles-cli + echo "--------------" +} +import(){ + echo "#TODO" + if [ ! -z $1 ] + then + if [ ! -d $1 ] + then + echo "Folder does not exists" + exit 4 + else + echo "Folder $1 exists" + fl="$(ls -1 $1)" + for f in $fl + do + add $1/$f + done + fi + else + echo "No value" + exit 6 + fi + exit 224 +} +add(){ + tempassin + if [ -f $1 ]; then + FILE="$1" + echo "Adding articles from " $FILE + DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') + TITLE=$(head -n 1 $FILE) + FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_SIGN_FILE=$FILE".asc" + gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) + cat > data <<EOF +{ + "datetime":"$DATETIME", + "title":"$TITLE", + "filename":"$FILE", + "ipfs":"$FILE_IPFS_HASH", + "detach":"$FILE_SIGNATURE" +} +EOF + else + echo "File $FILE doesn't exist"; + exit 2 + fi + pack_z_block "articles/add" data + if [ $? == 0 ] + then + echo "Articles added successfully" + else + echo "error??" + exit 1 + fi +} +usage(){ + echo "#TODO" + echo "All you need to know is that there are two options available:" + echo "help Prints this help message" + echo "index Prints an indexed table of your articles files" + echo "import <file> #TODO" + echo "add <file> Creates a data file from the articles file you point to" + echo "create Vim is going to pop up, you will write and save your" + echo " articlesletter and it's going to be saved" + exit 0 +} +title +if [ ! -z $1 ]; then + case $1 in + help) usage; exit;; + index) index; exit;; + import) import $2; exit;; + add) add $2; exit;; + create) create; exit;; + * ) usage;; + esac +else usage +fi diff --git a/bin/calculate-size b/bin/ak-calculate-size index 640d841..640d841 100755 --- a/bin/calculate-size +++ b/bin/ak-calculate-size diff --git a/bin/ak-categories b/bin/ak-categories new file mode 100755 index 0000000..cd6f55b --- /dev/null +++ b/bin/ak-categories @@ -0,0 +1,141 @@ +#!/bin/bash +ZNEWSDIR="$WORKDIR/news" +TEMP="/tmp/aktmp" +echo $ZNEWSDIR +if [ ! -d $ZNEWSDIR ]; then + mkdir $ZNEWSDIR + cd $ZNEWSDIR + git init + echo "News repository" > README + echo "Qmetc" >> README + git add README + git commit -m "Initiated news repository" + echo "znewsdir created along with git repo" +else + echo "znewsdir found" +fi +tempassin(){ + if [ ! -z $1 ] + then + TEMPASSIN="$1" + else + TIMESTAMP="$(date -u +%s)" + TEMPASSIN="/tmp/aktmp_$TIMESTAMP" + fi + if [ ! -d $TEMPASSIN ]; then + mkdir $TEMPASSIN + fi + cd $TEMPASSIN +} +create(){ + tempassin $TEMP + pwd + export NEWS_FILE="$(date +%Y%m%d_%H%M%S)" + vi $NEWS_FILE + echo "Renaming..." + TITLE="$(head -n 1 $NEWS_FILE)" + TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) + IPFS_FILE=$(ipfs add -q $NEWS_FILE) + mv $NEWS_FILE $ZNEWSDIR/$TO_FILE + sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZNEWSDIR/README + add $ZNEWSDIR/$TO_FILE + echo "Adding to git repo..." + cd $ZNEWSDIR + git add $TO_FILE README + git commit -m "Added $TO_FILE with $(head -n 1 $ZNEWSDIR/$TO_FILE)" + git clean --force + # rm -rf $TEMP +} +index(){ + FILES="$(ls -1 $ZNEWSDIR)" + i=0 + for FILE in $FILES + do + DATE=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') + TITLE=$(head -n 1 $ZNEWSDIR/$FILE) + echo $i \| $DATE \| $TITLE + let i+=1 + done +} +title(){ + echo ak-news-cli + echo "--------------" +} +import(){ + echo "#TODO" + if [ ! -z $1 ] + then + if [ ! -d $1 ] + then + echo "Folder does not exists" + exit 4 + else + echo "Folder $1 exists" + fl="$(ls -1 $1)" + for f in $fl + do + add $1/$f + done + fi + else + echo "No value" + exit 6 + fi + exit 224 +} +add(){ + tempassin + if [ -f $1 ]; then + FILE="$1" + echo "Adding news from " $FILE + DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') + TITLE=$(head -n 1 $FILE) + FILE_IPFS_HASH=$(ipfs add -q $FILE) + FILE_SIGN_FILE=$FILE".asc" + gpg --detach-sign --sign-with $FINGERPRINT --armor --output $FILE_SIGN_FILE $FILE + FILE_SIGNATURE=$(ipfs add -q $FILE_SIGN_FILE) + cat > data <<EOF +{ + "datetime":"$DATETIME", + "title":"$TITLE", + "filename":"$FILE", + "ipfs":"$FILE_IPFS_HASH", + "detach":"$FILE_SIGNATURE" +} +EOF + else + echo "File $FILE doesn't exist"; + exit 2 + fi + pack_z_block "news/add" data + if [ $? == 0 ] + then + echo "News added successfully" + else + echo "error??" + exit 1 + fi +} +usage(){ + echo "#TODO" + echo "All you need to know is that there are two options available:" + echo "help Prints this help message" + echo "index Prints an indexed table of your news files" + echo "import <file> #TODO" + echo "add <file> Creates a data file from the news file you point to" + echo "create Vim is going to pop up, you will write and save your" + echo " newsletter and it's going to be saved" + exit 0 +} +title +if [ ! -z $1 ]; then + case $1 in + help) usage; exit;; + index) index; exit;; + import) import $2; exit;; + add) add $2; exit;; + create) create; exit;; + * ) usage;; + esac +else usage +fi diff --git a/bin/comments b/bin/ak-comments index fc226b2..fc226b2 100755 --- a/bin/comments +++ b/bin/ak-comments diff --git a/bin/akconfig b/bin/ak-config index bc06e49..bc06e49 100755 --- a/bin/akconfig +++ b/bin/ak-config diff --git a/bin/extract-cids b/bin/ak-extract-cids index 06b7ebc..06b7ebc 100755 --- a/bin/extract-cids +++ b/bin/ak-extract-cids diff --git a/bin/ak-file.c b/bin/ak-file.c new file mode 100644 index 0000000..3d2ae17 --- /dev/null +++ b/bin/ak-file.c @@ -0,0 +1,27 @@ +/* + * ===================================================================================== + * + * Filename: file.c + * + * Description: + * + * Version: 1.0 + * Created: 08/12/22 07:23:49 + * Revision: none + * Compiler: gcc + * + * Author: Kaotisk Hund (kh), kaotisk@arching-kaos.org + * Company: ArchingKaos.Com + * + * ===================================================================================== + */ + +#include <stdio.h> + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + printf("printf used\n"); + return 0; +} diff --git a/bin/filejoiner b/bin/ak-filejoiner index 88d965c..88d965c 100755 --- a/bin/filejoiner +++ b/bin/ak-filejoiner diff --git a/bin/filesplitter b/bin/ak-filesplitter index 0f7919b..0f7919b 100755 --- a/bin/filesplitter +++ b/bin/ak-filesplitter diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock new file mode 100755 index 0000000..b9be842 --- /dev/null +++ b/bin/ak-find-latest-mined-sblock @@ -0,0 +1,76 @@ +#!/bin/bash +MINED_BLOCKS_DIR="/home/$USER/.arching-kaos/mined_blocks" +cd $MINED_BLOCKS_DIR +PROGRAM="$(basename $0)" +declare -A counters +logitnowint(){ + logthis "<$PROGRAM>" "$1" "$2" +} +further(){ + # logitnowint "[INFO]" "Diving into $1" + lookfor $1 +} + +lookfor(){ + echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null + if [ ! $? = 0 ] + then + logitnowint "[ERROR]" "Oops!!! The argument passed, does not match the regular expression!" + else + counters[$CHAIN_PARENT]="$(expr ${counters[$CHAIN_PARENT]} + 1)" + if [ ! $? = 0 ] + then + echo "$1, $counters[$1]" + exit 1 + fi + logitnowint "[INFO]" "Accessing file: $1" + # echo "$1 file:" + # cat "$1" | jq + NEXT_TARGET="$(cat "$1" | jq | grep previous | tr -d ' ' | sed -e 's/previous//g; s/[",:]//g;')" + if [ ! "$NEXT_TARGET" = "" ] + then + logitnowint "[INFO]" "Found previous: $NEXT_TARGET" + if [ ! -f "$NEXT_TARGET" ] + then + logitnowint "[WARNING]" "Could not find $NEXT_TARGET" + else + further "$NEXT_TARGET" + fi + else + + logitnowint "[WARNING]" "No next target found. So long for $1" + fi + fi +} + + +ls -1 > tmplistblock +while IFS="" read -r p || [ -n "$p" ] +do +# if [ ! "$p" = "" ] && [ ! "$p" = "tmplistblock" ] + if [ "$(echo $p | tr -d '\n' | wc -c)" = 128 ] + then + logitnowint "[INFO]" "Investigating $p..." + export CHAIN_PARENT="$p" + counters[$CHAIN_PARENT]=1 + lookfor "$p" + else + logitnowint "[WARNING]" "Nothing to do with $p" + fi +done < tmplistblock +rm tmplistblock +max=0 +max_holder=0 +for value in "${!counters[@]}" +do +# echo "${value} : ${counters[${value}]}" + if [ ${counters[${value}]} -gt $max ] + then + max="${counters[${value}]}" + max_holder="${value}" + logitnowint "[INFO]" "New MAX $max on $max_holder" + + + fi +done +echo '{"latest_block":"'$max_holder'"}' diff --git a/bin/follow b/bin/ak-follow index 76851e0..76851e0 100755 --- a/bin/follow +++ b/bin/ak-follow diff --git a/bin/following b/bin/ak-following index b333e50..b333e50 100755 --- a/bin/following +++ b/bin/ak-following diff --git a/bin/ak-get-akid b/bin/ak-get-akid new file mode 100755 index 0000000..17dcf74 --- /dev/null +++ b/bin/ak-get-akid @@ -0,0 +1,5 @@ +#!/bin/bash +# Resolves the IPNS key "ak-config" to its current IPFS value +# Return IPFS CIDv0 without /ipfs/ prefix +ipfs name resolve /ipns/$(ipfs key list -l | grep ak-config | awk '{print $1}') | sed -e 's/\/ipfs\///' + diff --git a/bin/ak-get-chain-minified b/bin/ak-get-chain-minified new file mode 100755 index 0000000..259cc36 --- /dev/null +++ b/bin/ak-get-chain-minified @@ -0,0 +1 @@ +enter | jq --compact-output diff --git a/bin/ak-get-gpg b/bin/ak-get-gpg new file mode 100755 index 0000000..14512f3 --- /dev/null +++ b/bin/ak-get-gpg @@ -0,0 +1,2 @@ +#!/bin/bash +akconfig show|jq| grep gpg | sed -e 's/"gpg": "//g; s/[," ]//g' diff --git a/bin/ak-get-ipfs-hashes-from-my-zchain b/bin/ak-get-ipfs-hashes-from-my-zchain new file mode 100755 index 0000000..db90ecb --- /dev/null +++ b/bin/ak-get-ipfs-hashes-from-my-zchain @@ -0,0 +1,2 @@ +#!/bin/bash +enter | json_pp | grep Qm | sed -e 's/{"zblock":"//g; s/",//; s/".*".*: "//g; s/"//g; s/{//g; s/://g; s/ //g' diff --git a/bin/get-latest b/bin/ak-get-latest index e770d1c..e770d1c 100755 --- a/bin/get-latest +++ b/bin/ak-get-latest diff --git a/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain b/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain new file mode 100755 index 0000000..2b9f580 --- /dev/null +++ b/bin/ak-get-only-ipfs-key-values-from-our-or-a-zchain @@ -0,0 +1,8 @@ +#!/bin/bash +# Outputs all the "ipfs" values from the DATA blocks of our ZCHAIN +if [ ! -z $1 ] +then + enter $1 | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' +else + enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' +fi diff --git a/bin/ak-get-only-ipfs-key-values-from-our-zchain b/bin/ak-get-only-ipfs-key-values-from-our-zchain new file mode 100755 index 0000000..8334f66 --- /dev/null +++ b/bin/ak-get-only-ipfs-key-values-from-our-zchain @@ -0,0 +1,3 @@ +#!/bin/bash +# Outputs all the "ipfs" values from the DATA blocks of our ZCHAIN +enter | jq | grep ipfs | awk '{print $2}' | sed -e 's/"//g;s/,//g' | sort | uniq diff --git a/bin/ipfs-check b/bin/ak-ipfs-check index 0e53599..0e53599 100755 --- a/bin/ipfs-check +++ b/bin/ak-ipfs-check diff --git a/bin/ipfs-starter b/bin/ak-ipfs-starter index 5cab1c3..5cab1c3 100755 --- a/bin/ipfs-starter +++ b/bin/ak-ipfs-starter diff --git a/bin/ipns-resolve b/bin/ak-ipns-resolve index 6ea3799..6ea3799 100755 --- a/bin/ipns-resolve +++ b/bin/ak-ipns-resolve diff --git a/bin/json2bash b/bin/ak-json2bash index 347ca93..347ca93 100755 --- a/bin/json2bash +++ b/bin/ak-json2bash diff --git a/bin/logfollow b/bin/ak-logfollow index f9f6ec9..f9f6ec9 100755 --- a/bin/logfollow +++ b/bin/ak-logfollow diff --git a/bin/logthis b/bin/ak-logthis index 347fd0b..347fd0b 100755 --- a/bin/logthis +++ b/bin/ak-logthis diff --git a/bin/ak-mempool b/bin/ak-mempool new file mode 100755 index 0000000..b0d6d4b --- /dev/null +++ b/bin/ak-mempool @@ -0,0 +1,19 @@ +#!/bin/bash +# Assumptions: +# I suppose each ak node is connected to some IP. +# They also run IPFS. +# They also are a part of our swarm. +# So should we ask for our peers? + +ipfs swarm peers > tmp_peers + + +while IFS="" read -r p || [ -n "$p" ] +do + peer="$(echo "$p" | sed -e 's/^.*\///')" + echo "Peer $peer found! Examining..." + ipfs cat /ipns/$peer/zlatest +done < tmp_peers + +rm tmp_peers + diff --git a/miner-script-prototype.sh b/bin/ak-miner-script index 5e686c5..5e686c5 100644..100755 --- a/miner-script-prototype.sh +++ b/bin/ak-miner-script diff --git a/bin/mixtapes b/bin/ak-mixtapes index aefaf26..aefaf26 100755 --- a/bin/mixtapes +++ b/bin/ak-mixtapes diff --git a/bin/ak-network b/bin/ak-network new file mode 100755 index 0000000..3a65d7b --- /dev/null +++ b/bin/ak-network @@ -0,0 +1,5 @@ +#!/bin/bash +while true +do + cat $ZLATEST | nc -lv 127.0.0.1 5050 +done diff --git a/bin/pack_z_block b/bin/ak-pack_z_block index 71aa4b7..71aa4b7 100755 --- a/bin/pack_z_block +++ b/bin/ak-pack_z_block diff --git a/bin/profile b/bin/ak-profile index ed83d29..ed83d29 100755 --- a/bin/profile +++ b/bin/ak-profile diff --git a/bin/reference b/bin/ak-reference index 59eaa04..59eaa04 100755 --- a/bin/reference +++ b/bin/ak-reference diff --git a/bin/repositories b/bin/ak-repositories index 3cd415f..3cd415f 100755 --- a/bin/repositories +++ b/bin/ak-repositories diff --git a/bin/ak-roadmap b/bin/ak-roadmap new file mode 100755 index 0000000..f4db04d --- /dev/null +++ b/bin/ak-roadmap @@ -0,0 +1,32 @@ +#!/bin/bash +title(){ + echo "AK Roadmap tool" +} + +usage(){ + title +} + +search(){ + cd $HOME/projects + PRJS="$(ls -1 .)" + for prj in $PRJS + do + if [ -f $prj/ROADMAP.md ]; + then + echo " - Roadmap found in $prj" + fi + done +} + +if [ ! -z $1 ]; +then + case $1 in + help) usage; exit;; + search) search; exit;; + *) usage; exit;; + esac +else + usage + exit 0 +fi diff --git a/bin/ak-show_sblock b/bin/ak-show_sblock new file mode 100755 index 0000000..f65daec --- /dev/null +++ b/bin/ak-show_sblock @@ -0,0 +1,9 @@ +#!/bin/bash +PROGRAM="show_sblock" +MINED_BLOCKS_DIR="/home/kaotisk/.arching-kaos/mined_blocks/" +if [ ! -z $1 ] +then + cat $MINED_BLOCKS_DIR$1 | jq +else + echo "No sblock hash input" +fi diff --git a/bin/tempassin b/bin/ak-tempassin index 101796e..101796e 100755 --- a/bin/tempassin +++ b/bin/ak-tempassin diff --git a/bin/ak-todos b/bin/ak-todos new file mode 100755 index 0000000..0c59bba --- /dev/null +++ b/bin/ak-todos @@ -0,0 +1,140 @@ +#!/bin/bash +ZTODOSDIR="$WORKDIR/todos" +TEMP="/tmp/aktmp" +if [ ! -d $ZTODOSDIR ]; then + mkdir $ZTODOSDIR + cd $ZTODOSDIR + git init + echo "Todos repository" > README + echo "Qmetc" >> README + git add README + git commit -m "Initiated todos repository" + logthis "ztodosdir created along with git repo" +else + logthis "ztodosdir found" +fi +tempassin(){ + if [ ! -z $1 ] + then + TEMPASSIN="$1" + else + TIMESTAMP="$(date -u +%s)" + TEMPASSIN="/tmp/aktmp_$TIMESTAMP" + fi + if [ ! -d $TEMPASSIN ]; then + mkdir $TEMPASSIN + fi + cd $TEMPASSIN +} +create(){ + tempassin $TEMP + pwd + export TODOS_FILE="$(date -u +%s)" + vi $TODOS_FILE + logthis "Renaming..." + TITLE="$(head -n 1 $TODOS_FILE)" + TO_FILE=$TODOS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) + IPFS_FILE=$(ipfs add -q $TODOS_FILE) + mv $TODOS_FILE $ZTODOSDIR/$TO_FILE + sed -e 's,Qm.*,'"$IPFS_FILE"',g' $ZTODOSDIR/README + add $ZTODOSDIR/$TO_FILE + logthis "Adding to git repo..." + cd $ZTODOSDIR + git add $TO_FILE README + git commit -m "Added $TO_FILE with $(head -n 1 $ZTODOSDIR/$TO_FILE)" + git clean --force + # rm -rf $TEMP +} +index(){ + FILES="$(ls -1 $ZTODOSDIR)" + i=0 + for FILE in $FILES + do + DATE=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') + TITLE=$(head -n 1 $ZTODOSDIR/$FILE) + echo $i \| $DATE \| $TITLE + let i+=1 + done +} +title(){ + echo ak-todos-cli + echo "--------------" +} +import(){ + echo "#TODO" + if [ ! -z $1 ] + then + if [ ! -d $1 ] + then + echo "Folder does not exists" + exit 4 + else + echo "Folder $1 exists" + fl="$(ls -1 $1)" + for f in $fl + do + add $1/$f + done + fi + else + echo "No value" + exit 6 + fi + exit 224 +} +add(){ + tempassin + if [ -f $1 ]; then + FILE="$1" + logthis "Adding todos from $FILE" |