Skip to content

Instantly share code, notes, and snippets.

@antlauzon
Created May 12, 2021 19:18
Show Gist options
  • Save antlauzon/56f9d4f1e1fa28cf3c5bb5846926f28a to your computer and use it in GitHub Desktop.
Save antlauzon/56f9d4f1e1fa28cf3c5bb5846926f28a to your computer and use it in GitHub Desktop.
shitcoin generator
#!/bin/bash
# shitcoin generator
# usage example:
# ./shitgen.sh shitcoin stc 9999
IFS=$'\n'
SED=sed
which gsed > /dev/null
if [[ $? == '0' ]]; then
SED=gsed
fi
SHITCOIN_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]')
SHORT_NAME=$(echo "$2" | tr '[:lower:]' '[:upper:]')
SHORT_NAME_LOWER=$(echo "$SHORT_NAME" | tr '[:upper:]' '[:lower:]')
SHITCOIN_NAME_LOWER=$(echo "$SHITCOIN_NAME" | tr '[:upper:]' '[:lower:]')
SHORT_NAME_CAMEL=$(echo $SHORT_NAME_LOWER | $SED -r 's/(^|-)(\w)/\U\2/g')
SHITCOIN_NAME_CAMEL=$(echo $SHITCOIN_NAME_LOWER | $SED -r 's/(^|-)(\w)/\U\2/g')
SHITCOIN_PORT=$3
echo "creating $SHITCOIN_NAME_LOWER"
git clone https://github.com/bitcoin/bitcoin.git $SHITCOIN_NAME_LOWER
cd $SHITCOIN_NAME_LOWER
rm -rf .git
for f in $(find . -type f); do
echo $f
$SED -i "s/BTC/$SHORT_NAME/g" $f
$SED -i "s/Btc/$SHORT_NAME_CAMEL/g" $f
$SED -i "s/btc/$SHORT_NAME_LOWER/g" $f
$SED -i "s/BITCOIN/$SHITCOIN_NAME/g" $f
$SED -i "s/Bitcoin/$SHITCOIN_NAME_CAMEL/g" $f
$SED -i "s/bitcoin/$SHITCOIN_NAME_LOWER/g" $f
$SED -i "s/ \([0-9]\)8333/ \1$SHITCOIN_PORT/g" $f
$SED -i "s/ 8333/ $SHITCOIN_PORT/g" $f
$SED -i "s/:\([0-9]\)8333/:\1$SHITCOIN_PORT/g" $f
$SED -i "s/:8333/:$SHITCOIN_PORT/g" $f
fn=$(echo $f | $SED "s/BITCOIN/$SHITCOIN_NAME/g")
fn=$(echo $fn | $SED "s/Bitcoin/$SHITCOIN_NAME_CAMEL/g")
fn=$(echo $fn | $SED "s/bitcoin/$SHITCOIN_NAME_LOWER/g")
mv "$f" "$fn"
echo "$fn"
done
git init .
git add *
git commit -a -m "$SHITCOIN_NAME_LOWER initial"
echo "$SHITCOIN_NAME_LOWER ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment