Skip to content

Instantly share code, notes, and snippets.

@ericboehs
Last active August 29, 2015 14:02
Show Gist options
  • Save ericboehs/151176f98682aab65c0b to your computer and use it in GitHub Desktop.
Save ericboehs/151176f98682aab65c0b to your computer and use it in GitHub Desktop.

Revisions

  1. ericboehs revised this gist Jun 23, 2014. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions setup_wifi
    Original file line number Diff line number Diff line change
    @@ -25,8 +25,10 @@ SPARK_TTY="$(spark serial list | grep dev | awk '{print $2}')"
    stty -f $SPARK_TTY 9600

    if [ "$SILENT" != "true" ]; then
    cat $SPARK_TTY &
    cat_pid=$?
    echo "Reading from Spark Core. Password ommited from output..."
    echo
    grep -v Password $SPARK_TTY &
    cat_pid=$!
    fi

    echo -n "w" > $SPARK_TTY
  2. ericboehs revised this gist Jun 23, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion setup_wifi
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    #! /usr/bin/env bash

    #
    # You will need the spark core cli installed first (and nodejs):
    # npm install -g spark-cli
    # spark cloud login
    #
    # To set SSID and PASSPHRASE, change below or run:
    # git config spc.wifi.ssid YOUR_SSID
    # git config spc.wifi.passphrase YOUR_PASSPHRASE
  3. ericboehs revised this gist Jun 23, 2014. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions setup_wifi
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,26 @@
    #! /usr/bin/env bash
    #
    # You will need the spark core cli installed first (and nodejs):
    # npm install -g spark-cli
    # spark cloud login
    #

    # To set SSID and PASSPHRASE, change below or run:
    # git config spc.wifi.ssid YOUR_SSID
    # git config spc.wifi.passphrase YOUR_PASSPHRASE

    set -e

    SPARK_TTY="$(spark serial list | grep dev | awk '{print $2}')"
    SSID="$(git config --get spc.wifi.ssid)"
    PASSPHRASE="$(git config --get spc.wifi.passphrase)"
    ENCRYPTION_TYPE=3
    SILENT=false

    [[ -e $SPARK_TTY ]] || echo "Spark Core not found. Aborting.."
    SILENT="false"

    SPARK_TTY="$(spark serial list | grep dev | awk '{print $2}')"
    [[ ! -e $SPARK_TTY ]] && \
    echo "Spark Core not found. Ensure it is connected via USB and in listening mode (flashing blue)." && \
    echo "To enter listening mode, hold the mode button for 3 seconds." && \
    exit 1

    stty -f $SPARK_TTY 9600

    if [ $SILENT != true ]; then
    if [ "$SILENT" != "true" ]; then
    cat $SPARK_TTY &
    cat_pid=$?
    fi
    @@ -33,7 +33,7 @@ echo $ENCRYPTION_TYPE > $SPARK_TTY
    sleep 0.5
    echo $PASSPHRASE > $SPARK_TTY

    if [ $SILENT != true ]; then
    if [ "$SILENT" != "true" ]; then
    sleep 9
    kill $cat_pid
    fi
  4. ericboehs created this gist Jun 23, 2014.
    39 changes: 39 additions & 0 deletions setup_wifi
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    #! /usr/bin/env bash
    #
    # You will need the spark core cli installed first (and nodejs):
    # npm install -g spark-cli
    # spark cloud login
    #
    # To set SSID and PASSPHRASE, change below or run:
    # git config spc.wifi.ssid YOUR_SSID
    # git config spc.wifi.passphrase YOUR_PASSPHRASE

    set -e

    SPARK_TTY="$(spark serial list | grep dev | awk '{print $2}')"
    SSID="$(git config --get spc.wifi.ssid)"
    PASSPHRASE="$(git config --get spc.wifi.passphrase)"
    ENCRYPTION_TYPE=3
    SILENT=false

    [[ -e $SPARK_TTY ]] || echo "Spark Core not found. Aborting.."

    stty -f $SPARK_TTY 9600

    if [ $SILENT != true ]; then
    cat $SPARK_TTY &
    cat_pid=$?
    fi

    echo -n "w" > $SPARK_TTY
    sleep 0.5
    echo $SSID > $SPARK_TTY
    sleep 0.5
    echo $ENCRYPTION_TYPE > $SPARK_TTY
    sleep 0.5
    echo $PASSPHRASE > $SPARK_TTY

    if [ $SILENT != true ]; then
    sleep 9
    kill $cat_pid
    fi