<commit_before>#!/bin/bash

service network-manager stop

ifconfig wlan0 up || exit 1

echo "Scanning available networks:"
pattern='(Cell [0-9]+ - Address:)|(ESSID:)|(Encryption key|IE: WPA)'
iwlist wlan0 scan | grep --color=never -E "$pattern"

echo -n "Enter ESSID: "
read
essid="$REPLY"

echo -n "Enter password: "
stty -echo
read
password="$REPLY"
stty echo

echo
echo "Connecting to '$essid'"

#iwconfig wlan0 essid "$essid" key "s:$key" || exit 2

config_file="`tempfile`"

wpa_passphrase "$essid" "$password" >"$config_file"

password=""
essid=""

wpa_supplicant -B -D nl80211 -i wlan0 -c "$config_file"

error=$?
rm "$config_file"

[ $error -eq 0 ] || exit 2

echo "Obtaining IP address"

dhclient wlan0 || exit 3
<commit_msg>wifi.sh: make wi-fi work with hidden SSID<commit_after>#!/bin/bash

service network-manager stop

ifconfig wlan0 up || exit 1

echo "Scanning available networks:"
pattern='(Cell [0-9]+ - Address:)|(ESSID:)|(Encryption key|IE: WPA)'
iwlist wlan0 scan | grep --color=never -E "$pattern"

echo -n "Enter ESSID: "
read
essid="$REPLY"

echo -n "Enter password: "
stty -echo
read
password="$REPLY"
stty echo

echo
echo "Connecting to '$essid'"

#iwconfig wlan0 essid "$essid" key "s:$key" || exit 2

config_file="`tempfile`"

cat >"$config_file" <<EOF
ap_scan=1
fast_reauth=1

EOF

wpa_passphrase "$essid" "$password" \
    | grep -v '^ *}$' >>"$config_file"

cat >>"$config_file" <<EOF
        scan_ssid=1
}
EOF

password=""
essid=""

wpa_supplicant -B -D nl80211 -i wlan0 -c "$config_file"

error=$?
rm "$config_file"

[ $error -eq 0 ] || exit 2

echo "Obtaining IP address"

dhclient wlan0 || exit 3

{'fraction_non_alphanumeric': 0.1618638871857756, 'fraction_numerical': 0.022685469037400367, 'mean_word_length': 4.513513513513513, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2920173', 'n_tokens_mistral': 672, 'n_tokens_neox': 647, 'n_words': 189}