Skip to content

Instantly share code, notes, and snippets.

Christopher Peplin peplin

Block or report user

Report or block peplin

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
@peplin
peplin / pygatt_test.py
Created Sep 10, 2016
A quick test for running the 2 pygatt backends in a coffee shop, connecting to any device we can and reading one characteristic
View pygatt_test.py
#!/usr/bin/env python
from __future__ import print_function
import logging
logging.basicConfig()
logging.getLogger('pygatt').setLevel(logging.INFO)
import binascii
import pygatt
@peplin
peplin / combined_3des_key.py
Created Oct 9, 2015
Generate a combined 3DES key for DUKPT from two components
View combined_3des_key.py
from __future__ import print_function
from Crypto.Cipher import DES3
import os
import binascii
def xor_bytes(this, that):
return bytearray([ord(x) ^ ord(y) for x, y in zip(this, that)])
@peplin
peplin / nose2_addressable_test_name.py
Created May 13, 2015
A nose2 plugin to render the name of tests as something you can copy and paste and provide to nose at the command line to run an individual test
View nose2_addressable_test_name.py
from nose2.events import Plugin
class AddressableTestNameOutcome(Plugin):
"""Render name of each test in results as as something you can copy and
paste and provide directly to nose2 at the command line to run a single
test.
"""
configSection = 'addressable_test_name'
@peplin
peplin / gist:88ef5f26c4cc53160448
Created Mar 19, 2015
Patch conflicting, old version of `six`
View gist:88ef5f26c4cc53160448
import pyxb
# pyxb bundles an old version of the 'six' package (1.5.1) that is not compatible with
# werkzeug 0.10's auto-reloader. It was fixed in six 1.5.2, and the latest
# release is 1.9.0! We work around it by deleting the one problematic module
# that is added (winreg is only available on Windows, Tk on Linux).
import sys
import copy
del sys.modules['pyxb.utils.six.moves.winreg']
for module in copy.copy(sys.modules):
@peplin
peplin / dupes.pl
Created Jun 16, 2014
Perl script to find duplicate filenames
View dupes.pl
#!/usr/bin/perl -w
use File::Find;
my %files;
my @dirs;
foreach $argnum (0 .. $#ARGV) {
push(@dirs, $ARGV[$argnum]);
}
@peplin
peplin / config.json
Created Jun 4, 2014
OpenXC custom command to send CAN message
View config.json
{ "buses": {
"hs": {
"controller": 1,
"speed": 500000,
"raw_writable": true
}
},
"commands": [
{"name": "my_custom_command",
"handler": "sendMyCanMessage"
@peplin
peplin / training.mkd
Created Sep 27, 2013
Ford APA OpenXC Training Sessions
View training.mkd

OpenXC Introduction

Length: 1 hour

OpenXC is an API to your car - by installing a small hardware module to read and translate metrics from a car's internal network, the data becomes accessible from most Android applications using the OpenXC library. You can start making vehicle-aware applications that have better interfaces based on context, can minimize distraction while driving, are integrated with other connected services, and can offer you more insight into your car's operation. This session presents a high level introduction to the OpenXC platform appropriate for engineers, business, IT, marketing, etc. The presentation will explain what OpenXC is and what was the motivation for creating the project at Ford and for releasing it as open source hardware and software. The high-level architecture of OpenXC will be detailed (Android apps, an DIY-friendly vehicle interface and a standardized data format) and some basic vehicle data concepts explained (like the CAN bus and read vs. write capabilities). The

@peplin
peplin / AndroidManifest.xml
Last active Dec 16, 2015
Complete example "Hello Car" app for OpenXC
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
@peplin
peplin / gist:5114028
Created Mar 8, 2013
Fixed PKGBUILD for dl-fldigi-git package in Arch AUR - https://aur.archlinux.org/packages/dl-fldigi-git/
View gist:5114028
# Contributor: [Philip Crump](mailto:pdc1g09@soton.ac.uk) aka M0DNY
# Maintainer: [Philip Crump](mailto:pdc1g09@soton.ac.uk) aka M0DNY
pkgname=dl-fldigi-git
#pkgver=3.21.36
pkgver=20130307
pkgrel=1
pkgdesc="Tracking Program for UK HAB Launches by James Coxon"
arch=('i686' 'x86_64')
url="https://github.com/jamescoxon/dl-fldigi"
@peplin
peplin / gist:2483204
Created Apr 24, 2012 — forked from agriffis/gist:2481292
.bashrc.virtualenvwrapper
View gist:2483204
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.
if [[ $(type -w workon) != "workon: function" ]]; then
virtualenv_funcs=( workon deactivate mkvirtualenv )
You can’t perform that action at this time.