Skip to content

Instantly share code, notes, and snippets.

View nrobinson2000's full-sized avatar

Nate Robinson nrobinson2000

View GitHub Profile
@nrobinson2000
nrobinson2000 / setup.sh
Created October 4, 2016 23:00
Alpha phase setup script for Raspberry Pi
#!/bin/bash
echo "Raspberry Pi Alpha Setup tool:"
echo
echo "Installing Screen..."
sudo apt-get install screen
echo
read -rp "Enter your Device ID: " deviceID
echo "$deviceID" > device_id.txt
Verifying that "nrobinson2000.id" is my Blockstack ID. https://onename.com/nrobinson2000
@nrobinson2000
nrobinson2000 / nrobinson2000-particle.js
Last active May 16, 2020 11:49
Call particle functions and get particle variables from a device in javascript
var token = "YOUR_PARTICLE_ACCESS_TOKEN";
var device = "YOUR_PARTICLE_DEVICEID";
function httpPost(url, params)
{
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
//Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
@nrobinson2000
nrobinson2000 / slack-bot.json
Created November 13, 2016 14:29
Sample webhook for publishing to slack
{
"eventName": "slack-bot",
"url": " https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ",
"requestType": "POST",
"json": {
"text": "{{PARTICLE_EVENT_VALUE}}",
"username": "particle-bot",
"icon_emoji": ":level_slider:"
},
"mydevices": true
@nrobinson2000
nrobinson2000 / bashrc
Created December 5, 2016 13:11
bashrc
export GPG_TTY=$(tty)
export PS1="\[$(tput setaf 6)\]\[$(tput bold)\]\u\[$(tput sgr0)\]\[$(tput setaf 5)\]\[$(tput bold)\]@\[$(tput setaf 7)\]\[$(tput bold)\]\h:\[$(tput sgr0)\]\[$(tput setaf 4)\]\[$(tput bold)\]\w $ \[$(tput sgr0)\]"
export EDITOR="nano"
export PARTICLE_DEVELOP=1
alias spark="particle"
alias ls="ls -G"
alias la="ls -la"
alias lh="ls -lah"
alias l="ls"
alias update="~/auto-git.sh"
@nrobinson2000
nrobinson2000 / httpGetJSON.js
Created April 23, 2017 15:58
Get a JSON object from API request
function httpGetJSON(url) // Get JSON object from an API
{
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false); // false for synchronous request
xhr.send( null );
return JSON.parse(xhr.responseText);
}
// Example from https://api.github.com/
// Get current_user_url
@nrobinson2000
nrobinson2000 / getLibURL.sh
Created August 21, 2017 03:30
Get the GitHub URL for a Particle library
#!/bin/bash
getLibURL()
{
TOKEN="$(cat ~/.particle/particle.config.json | grep 'token' | grep -oE '([0-Z])\w+')"
DATA=$(curl -sLH "Authorization: Bearer $TOKEN" "https://api.particle.io/v1/libraries/$1" | json_pp)
LIBURL=$(echo "$DATA" | grep "url" | grep -oE '"((?:\\.|[^"\\])*)"' | grep "http" | tr -d '"')
}
getLibURL "$1"
@nrobinson2000
nrobinson2000 / ParticleDetect.sh
Created April 6, 2018 23:59 — forked from jenschr/ParticleDetect.sh
Script to automate the setup of multiple Particle devices (Photon, P1, P0, Electron)
#!/bin/sh
# Basic setup script for devices
# Works on OSX + should also work for Unix.
# Users of Windows 10 (or higher) can likely use the builtin Ubuntu install.
#
# We need to do the following:
# 1. Query the computer for the relevant USB port
# 2. Set the device to listening mode (if required)
# 3. Query the device for the deviceID
@nrobinson2000
nrobinson2000 / .conkyrc
Last active October 1, 2018 19:21
My .conkyrc
# Conky configuration
background no
use_xft yes
xftfont Monospace:size=9
xftalpha 0
out_to_console no
update_interval 1
total_run_times 0
own_window yes
own_window_type desktop
@nrobinson2000
nrobinson2000 / README.md
Created September 4, 2018 18:38
Install Linux Mint on Razer Blade 15