Skip to content

Instantly share code, notes, and snippets.

View xtacocorex's full-sized avatar

Robert Wolterman xtacocorex

View GitHub Profile
@xtacocorex
xtacocorex / gist:17ad3fa728e012168a4fc848bb688ad4
Last active July 14, 2018 19:23
@Groguard's pocketchip battery script mods
#!/bin/sh
while true
do
###################
#read fuel gauge B9h
BAT_GAUGE_HEX=$(i2cget -y -f 0 0x34 0xb9)
#read power op mode
POWER_OP_MODE=$(i2cget -y -f 0 0x34 0x01)
# get charging indicator
CHARG_IND=$(($(($POWER_OP_MODE&0x40))/64)) # divide by 64 is like shifting rigth 6 times
# SIMPLE COIN MONITOR USING
# https://pypi.python.org/pypi/websocket-client
import websocket
import json
import time
# CONSTANTS
URL = "wss://api.hitbtc.com/api/2/ws"
@xtacocorex
xtacocorex / tacobot.py
Last active July 2, 2017 02:35
The TacoBot for Slack. Need to fill out __author__ and the testbench channel code
# TACOBOT - A FUN SLACK BOT
# ROBERT WOLTERMAN, 2017
# YAY
import os
import sys
import slackclient
import threading
import time
import json
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 4.4.13 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_ARM_DMA_USE_IOMMU=y
CONFIG_ARM_DMA_IOMMU_ALIGNMENT=8
CONFIG_MIGHT_HAVE_PCI=y
@xtacocorex
xtacocorex / batmon.sh
Created May 11, 2017 02:48
zwack's battery monitor for the chip so bigbadhodad can download it
#! /bin/sh
FUEL=$((`/usr/sbin/i2cget -y -f 0 0x34 0xb9`))
if [ $FUEL -lt 15 ]
then
echo "default-on" > /sys/class/leds/chip\:white\:status/trigger
elif [ $FUEL -eq 127 ]
then
echo "flash" > /sys/class/leds/chip\:white\:status/trigger
else
echo "none" > /sys/class/leds/chip\:white\:status/trigger
@xtacocorex
xtacocorex / chipwood_derby.py
Created January 14, 2017 03:13
Script for Toggling a CHIP GPIO to turn on/of Relay that powers a Pinewood Derby Car
#!/usr/bin/env python
# Python Controlled, CHIP Powered Pinewood Derby Car
# Robert Wolterman, 2017
# Module Imports
import CHIP_IO.GPIO as GPIO
# Global Variables
PIN_TO_USE = "XIO-P0"
@xtacocorex
xtacocorex / config.json
Created November 22, 2016 04:26
WebControl config.cfg as JSON
{
“username” : “myuser”,
“password” : “pass”,
“secretkey" : “keepitsecret”,
“devices” :
[
{“pin” : “XIO-P0”, “name” : “Light 1”, “state” : true, “time on” : 20, “time off” : 4, “timer” : “on”},
{“pin” : “XIO-P2”, “name” : “Pump 1”, “state” : true, “time on” : 12, “time off” : 12, “timer” : “off”},
{“pin” : “XIO-P4”, “name” : “Fan 1”, “state” : true, “time on” : 12, “time off” : 12, “timer” : “off”},
{“pin” : “XIO-P6”, “name” : “Random 1”, “state” : true, “time on” : 12, “time off” : 12, “timer” : “off”}
@xtacocorex
xtacocorex / config.json
Created June 17, 2016 03:36
hacked up config.json for pocket chip to sets a second page of apps
{
"defaultPage" : "Apps",
"pages": [
{
"name": "Apps",
"items": [
{
"name": "Terminal",
"icon": "appIcons/terminal.png",
"shell": "vala-terminal -fs 8 -g 20 20"
@xtacocorex
xtacocorex / chip_batt_autoshutdown.sh
Last active May 22, 2018 09:04
CHIP Auto Shutdown based upon battery level
#!/bin/bash
# 2016 ROBERT WOLTERMAN (xtacocorex)
# WITH HELP FROM CHIP-hwtest/battery.sh
# THIS NEEDS TO BE RUN AS ROOT
# PROBABLY SET AS A CRON JOB EVERY 5 OR 10 MINUTES
# SIMPLE SCRIPT TO POWER DOWN THE CHIP BASED UPON BATTERY VOLTAGE
@xtacocorex
xtacocorex / adctest.c
Last active February 21, 2018 10:24
CHIP Internal ADC Test Code
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#define LRADC 0x01C22800
#define CTRL_OFFSET 0x00