Skip to content

Instantly share code, notes, and snippets.

Jon Harris lardconcepts

Block or report user

Report or block lardconcepts

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
@lardconcepts
lardconcepts / ons-api.py
Created Nov 27, 2016 — forked from sammachin/ons-api.py
Fetch Data from the ONS-API as JSON STAT then turn that into a set of simple numbers
View ons-api.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-import json
# vim: set et sw=4 fenc=utf-8:
import json
import requests
def process(obj, ds):
data = {}
values = obj[ds]['value']
View dp-output
Before file: ---1--- len 6 after file: ---1▒--- len 7 hexdump:00000000 31|1| 00000001
Before file: ---12--- len 6 after file: ---12--- len 7 hexdump:00000000 31 32 |12| 00000002
Before file: ---123--- len 6 after file: ---123--- len 7 hexdump:00000000 31 32 33 |123| 00000003
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773 ast_channel_publish_varset: Error creating message
Before file: ---1234--- len 6 after file: ---1234--- len 7 hexdump:00000000 31 32 33 34 |1234| 00000004
Before file: ---12345--- len 6 after file: ---1234--- len 7 hexdump:00000000 31 32 33 34 35|12345| 00000005
Before file: ---123456--- len 6 after file: ---123456--- len 7 hexdump:00000000 31 32 33 34 35 36 |123456| 00000006
View test-dp
exten => 5,1,Verbose(Context: ${CONTEXT} Exten:${EXTEN})
same => n,Set(feature=${FILE(/home/test/feature-1.txt,0,1,l,u)})
same => n,set(myList=1,12,123,1234,12345,123456,A,AB,ABC,ABCD,ABCDE,ABC123)
same => n,While($["${SET(rawVar=${SHIFT(myList)})}" != ""])
same => n,SET(FILE(${featurefile})=${rawVar})
same => n,SET(fileVar=${FILE(${featurefile},0,1,l,u)})
same => n,SET(hexDump=${SHELL(hd ${featurefile})})
same => n,Verbose(Before file: ---${rawVar}--- len ${LEN(rawVar)} after file: ---${fileVar}--- LEN ${LEN(${fileVar})} hexdump:${hexDump})
same => n,EndWhile()
same => n,Hangup()
@lardconcepts
lardconcepts / suitecrm.conf
Created Aug 10, 2016
SuiteCRM nginx config
View suitecrm.conf
server {
server_name crm.mysite.com;
listen [::]:80;
listen [::]:443 ssl http2;
listen 80;
listen 443 ssl http2;
ssl_session_timeout 1d;
@lardconcepts
lardconcepts / dropbox.service.md
Last active Jan 11, 2016 — forked from jsturgis/dropbox.service.md
ubuntu 15.04 dropbox systemd
View dropbox.service.md

Install Dropbox and python script, symlink python script to /usr/local/bin/dropbox and add to your path.

Original script from jsturgis/dropbox.service.md

/etc/systemd/system/dropbox.service contents

[Unit]
Description=Dropbox Service
After=network.target
View timer1_and_spi.ino
#include <TimerOne.h>
#include <SPI.h>
void setup() {
Timer1.initialize();
Timer1.attachInterrupt(spiTest, 1);
}
void loop() {
}
@lardconcepts
lardconcepts / README.md
Last active Dec 22, 2015
Code for returning switch pushes to Raspberry PI with Arduino as SPI slave. See http://minus.com/l1P68REAlw8NQ
View README.md

Raspberry PI <> Arduino via SPI.

Introduction

  • Allows the RaspberryPI as a master to poll the Arduino for a bit of data.
  • Tested at between 125Kz and 2MHz.
  • Using Model B Rev 2 with Raspbian installed via NOOBS

Warnings

@lardconcepts
lardconcepts / oledtest.py
Last active May 28, 2018
winstar oled test
View oledtest.py
#!/usr/bin/python
# Winstar WEG010032ALPP5N00000 Graphic OLED and WS0010 OLED driver code for
# Raspberry Pi GPIO library. Some code originally found at
# http://forums.adafruit.com/viewtopic.php?f=8&t=29207&start=15#p163445
# Based on http://www.rpiblog.com/2012/11/interfacing-16x2-lcd-with-raspberry-pi.html
# Massive respec to UHCLEM in that post for getting me on the right track.
#
# Timing & initialisation issues resolved with help of LCD Initialization guide
# http://web.alfredstate.edu/weimandn/lcd/lcd_initialization/lcd_initialization_index.html
@lardconcepts
lardconcepts / stepper2.ino
Created Nov 30, 2012 — forked from sbright33/stepper2.ino
Stepper library for 28BYJ-48
View stepper2.ino
// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, which is readily available on eBay for $4.25 inc shipping,
// using a ULN2003 interface board to drive the stepper. The 28BYJ-48
// motor is a 4-phase, 8-beat motor, geared down by a factor of 64. One
// bipolar winding is on motor pins 1,3 and the other on motor pins 2,4.
// Refer to the manufacturer's documentation of Changzhou Fulling
// Motor Co., Ltd., among others. The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.
// Vin w USB power is 4.5v too slow for testing use 5v pin.
//#include <Narcoleptic.h>
@lardconcepts
lardconcepts / sbright_arduino_28BYJ-48_stepper.ino
Created Nov 26, 2012
sbright33's Arduino stepper motor driver demo
View sbright_arduino_28BYJ-48_stepper.ino
// EDIT: ***THIS VERSION IS OBSOLETE!!***
// PLEASE SEE NEW VERSION AT https://gist.github.com/4178431
// cobbled together from http://arduino.cc/forum/index.php/topic,85335.15.html
// all work by sbright33, not me.
#define dw digitalWrite
#define dm delayMicroseconds
const int mp1 = 4; // Blue - 28BYJ48 pin 1
const int mp2 = 5; // Pink - 28BYJ48 pin 2
You can’t perform that action at this time.