Skip to content

Instantly share code, notes, and snippets.

View ConnorRigby's full-sized avatar
🏎️

Connor Rigby ConnorRigby

🏎️
View GitHub Profile
#!/bin/bash
mkdir $HOME/ts3
cd $HOME/ts3
wget http://dl.4players.de/ts/releases/3.0.13.3/teamspeak3-server_linux_amd64-3.0.13.3.tar.bz2
tar -xvf teamspeak3-server_linux_amd64-3.0.13.3.tar.bz2
cd teamspeak3-server_linux_amd64-3.0.13.3.tar.bz2
bash ts3server_startscript.sh
@ConnorRigby
ConnorRigby / e.bash
Last active September 11, 2016 03:00
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.1.0
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
source $HOME/.asdf/asdf.sh
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install erlang 19.0
asdf install elixir 1.3.1
asdf global erlang 19.0
asdf global elixir 1.3.1
// This is usefull for checking unused reducer functions.
const uselessReducerDetector = storeObj => next => action => {
let result = next(action);
let state1 = storeObj.getState();
let state2 = reducers(state1, result);
let isEqual = JSON.stringify(state1) === JSON.stringify(state2);
if (isEqual && action.type[0] !== "@") {
console.warn(`${action.type} didn't change state. May or may not be useless.`);
} else {
return result;
Farmbot.prototype._onmessage = function (_, buffer /*, message*/) {
var msg = JSON.parse(buffer.toString());
if(msg && (msg.method && msg.params && (msg.id === null))) {
console.log("Notification");
this.emit("notification", msg);
return;
}
if(msg && (msg.id)){
this.emit(msg.id, msg);
return;
{
"id":1,
"device_id":1,
"name":"Sequencer test",
"kind":"sequence",
"color":"purple",
"args":{
},
"body":[
@ConnorRigby
ConnorRigby / update.sh
Last active October 23, 2016 16:41
script to download the latest farmbot arduino firmware
sudo -i
apt-get install avrdude
mkdir /tmp/farmbot-firmware
cd /tmp/farmbot-firmware
wget https://github.com/FarmBot/farmbot-arduino-firmware/releases/download/v0.0.1/firmware.hex -O firmware.hex
HEX_FILE=$(pwd)/firmware.hex
if [ -a /dev/ttyACM0 ]
then
TTY=/dev/ttyACM0
elif [ -a /dev/ttyUSB0 ]
{
"pins": {
"9": {
"value": 1,
"mode": 0
},
"10": {
"value": 1,
"mode": 0
},
# When pin is 10-99 and value is 0-9
def parse_code(<<"R21 P", param :: size(16)," V", value :: size(8), " Q", tag :: binary>>)
do { :report_parameter_value, param, value, tag } end
# When param is 10-99 and up and value is 10-99
def parse_code(<<"R21 P", param :: size(16)," V", value :: size(16), " Q", tag :: binary>>)
do { :report_parameter_value, param, value, tag } end
# When param is 10-99 and up and value is 100-999
def parse_code(<<"R21 P", param :: size(16)," V", value :: size(24), " Q", tag :: binary>>)
do { :report_parameter_value, param, value, tag } end
# When param is 10-99 and up and value is 1000-9999
Erlang/OTP 19 [erts-8.0] [source] [smp:4:4] [async-threads:10] [kernel-poll:false]
00:00:05.571 [debug] Elixir.Nerves.Networking Starting
00:00[ 5.700939] random: nonblocking pool is initialized
:05.604 [debug] initializing Networking.Subsystem
00:00:06.083 [debug] Starting Network
"ticker_error",
"ticker",
"toast_success",
"toast_error",
"toast_warning"