<commit_before>#!/bin/bash

# Sets up a Raspberry Pi for the Robotic Light Ballet project.
# This should be run on the Pi(s) that will connect to the primary.


# Pull down and source the common functions
wget --no-check-certificate -O pi-setup-common.sh https://raw.githubusercontent.com/mitmuseumstudio/RoboticLightBallet/master/pi-setup/pi-setup-common.sh

. ./pi-setup-common.sh

# get a custom hostapd that can deal with the Belkin WiFi
echo "Getting Adafruit hostapd"
wget http://www.adafruit.com/downloads/adafruit_hostapd.zip
unzip adafruit_hostapd.zip

HOSTAPD=/usr/sbin/hostapd
PRESERVE $HOSTAPD
mv hostapd $HOSTAPD
chmod 755 $HOSTAPD

# Set up the config files
INTERFACES=/etc/network/interfaces
echo "Setting up $INTERFACES"
PRESERVE $INTERFACES
cat <<EOF > $INTERFACES
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.0.0
EOF

HOSTAPDCONF=/etc/hostapd/hostapd.conf
echo "Setting up $HOSTAPDCONF"
PRESERVE $HOSTAPDCONF
cat <<EOF > $HOSTAPDCONF
interface=wlan0
driver=rtl871xdrv
ssid=studiobot
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=<PASSWORD>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
EOF

HOSTAPDDEFAULT=/etc/default/hostapd
echo "Setting up $HOSTAPDDEFAULT"
PRESERVE $HOSTAPDDEFAULT
FRESH $HOSTAPDDEFAULT
cat <<EOF >> $HOSTAPDDEFAULT
DAEMON_CONF="$HOSTAPDCONF"
EOF

DHCPCONF=/etc/dhcp/dhcpd.conf
echo "Setting up $DHCPCONF"
PRESERVE $DHCPCONF
FRESH $DHCPCONF
cat <<EOF >> $DHCPCONF
subnet 10.10.0.0 netmask 255.255.0.0 {
  range 10.10.0.2 10.10.0.10;
}
EOF

echo "Activate wlan0, hostapd, and isc-dhcp-server"
ifdown wlan0
ifup wlan0
/etc/init.d/hostapd restart
/etc/init.d/isc-dhcp-server restart

ifconfig
<commit_msg>Put in the wpa_supplicant info to set up the client<commit_after>#!/bin/bash

# Sets up a Raspberry Pi for the Robotic Light Ballet project.
# This should be run on the Pi(s) that will connect to the primary.


# Pull down and source the common functions
wget --no-check-certificate -O pi-setup-common.sh https://raw.githubusercontent.com/mitmuseumstudio/RoboticLightBallet/master/pi-setup/pi-setup-common.sh

. ./pi-setup-common.sh

SUPPLICANT=/etc/wpa_supplicant/wpa_supplicant.conf
PRESERVE $SUPPLICANT
FRESH $SUPPLICANT
cat <<EOF >> $SUPPLICANT
network={
ssid="studiobot"
psk="lightballet"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
EOF

ifconfig

{'fraction_non_alphanumeric': 0.09889660809154066, 'fraction_numerical': 0.024111156518185534, 'mean_word_length': 5.08955223880597, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4097755', 'n_tokens_mistral': 1016, 'n_tokens_neox': 976, 'n_words': 239}