Skip to content

Instantly share code, notes, and snippets.

Garrett Bartley wgbartley

Block or report user

Report or block wgbartley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wgbartley
wgbartley / drain-list.sh
Last active Sep 26, 2017
Drain Redis List to X elements
View drain-list.sh
#!/bin/sh
# Max number of concurrent Redis connections before we back off
CONN_LIMIT=10000
# Check to make sure all arguments were passed
DO_EXIT=0
if [ "$1" == "" ]; then
echo "Please provide a list name (in quotes) as first argument."
@wgbartley
wgbartley / test.ino
Created Nov 12, 2015
Quick NeoPixel test on Bluz
View test.ino
#include "application.h"
#include "pinmap_impl.h"
#include "neopixel.h"
#define STRIP_LENGTH 121
int PIXEL_PIN = PIN_MAP[D2].gpio_pin;
neopixel_strip_t m_strip;
uint8_t j;
View oled_logo_example.ino
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
Adafruit_SSD1306 display(D0);
static const uint8_t particle[480] = {
0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000,
0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000,
0B00000000, 0B00000011, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000,
0B00000000, 0B00000011, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B00000010, 0B00000000, 0B00000000,
0B00000000, 0B00000011, 0B00000000, 0B00000000, 0B00001111, 0B11111111, 0B00000000, 0B00000000, 0B00000000, 0B00000000, 0B010
@wgbartley
wgbartley / gist:b9f1f016b0e223699da0
Last active Aug 29, 2015
Discourse Forum User Post Alert
View gist:b9f1f016b0e223699da0
/**
* This monitors a Discourse forum for postings by a particular user.
* I stopped just shy of figuring out how to publish an event to a
* Particle device PubSub stream.
**/
var https = require('https'),
cp = require('child_process'),
xmlParseString = require('xml2js').parseString;
View spark-web-ide-memory-tracker.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://benpickles.github.io/peity/jquery.peity.js"></script>
<script type="text/javascript">
@wgbartley
wgbartley / launch_webs.sh
Last active Aug 29, 2015
Docker web container launcher
View launch_webs.sh
#!/bin/bash
for d in $(find www-enabled/ -mindepth 1 -maxdepth 1 -type l); do
bn=`basename $d`
aliases_arr=($bn)
aliases_i=1
# Check if the container is already running
is_running=`docker ps -f status=running | grep "$bn" | wc -l`
@wgbartley
wgbartley / webcam-viewer.py
Created Jul 14, 2014
Grab latest webcam picture and display it on a monitor from the command-line
View webcam-viewer.py
#!/usr/bin/python
import pygame, httplib, io
from pygame.locals import *
from PIL import Image, ImageFont, ImageDraw
from time import time, sleep, strftime, localtime
# Screen setup
print "Press ctrl+c"
display = pygame.display
@wgbartley
wgbartley / angry-bird.ino
Created Jun 7, 2014
Spark-Powered Angry Bird Swimmer
View angry-bird.ino
// D0 = Angle Down
// D1 = Angle Up
// D2 = Left
// D3 = Right
int pinLeft = D2;
int pinRight = D3;
int pinDown = D0;
int pinUp = D1;
View Spark-Uptime.cpp
char srvIP[] = "256.256.256.256";
char srvHost[] = "myhost.mydomain.tld";
int srvPort = 80;
char srvPath[] = "/?l=test1";
void setup() {
delay(5000);
pinMode(D7, OUTPUT);
@wgbartley
wgbartley / uptime.ino
Created May 26, 2014
Spark Uptime Test
View uptime.ino
char srvIP[] = "198.199.86.22";
char srvHost[] = "spark.wgb.me";
int srvPort = 80;
char srvPath[] = "/logger/?l=uptime-test";
void setup() {
delay(5000);
pinMode(D7, OUTPUT);
You can’t perform that action at this time.