Skip to content

Instantly share code, notes, and snippets.

View Terrabits's full-sized avatar

Nick Lalic Terrabits

View GitHub Profile
@Terrabits
Terrabits / assert_admin.bat
Created June 22, 2020 17:57
asserts that the current environment includes administrator privileges
rem Batch script: how to check for admin rights
rem https://stackoverflow.com/a/11995662/1390788
net session >nul 2>&1
if not %ErrorLevel% == 0 (
echo "ERROR: no administrative priviliges"
exit /b 1
@Terrabits
Terrabits / configure_ssh_and_wifi
Last active January 14, 2019 09:27
Raspbian WiFi and SSH for headless install
#!/usr/bin/env bash
# Enable SSH
touch /Volumes/boot/ssh
# Set up WiFi
cat << EOF > /Volumes/boot/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="YOUR_SSID"
@Terrabits
Terrabits / init.lua
Created January 11, 2019 07:21
NodeMCU firmware init with WiFi
-- tested on HiLetgo NodeMCU v1.0
-- requires modules: wifi, tmr
-- (and optionally gpio for blinky light)
local ssid = "ssid"
local password = "password"
local BLUE_LED = 4
function connect_to_wifi(ssid, password)
wifi.setmode(wifi.STATION)
wifi.sta.config(ssid, password)