Skip to content

Instantly share code, notes, and snippets.

View RUCAnalysis.py
import datetime
import re
class RUCAnalysis(object):
def __init__(self, gsd):
lines = gsd.split('\n')
self.soundings = []
@jamesshannon
jamesshannon / capture-test.py
Last active Jan 25, 2019 — forked from loganwilliams/capture-test.py
Test script for capturing data from Heimman HTPA 32x32d
View capture-test.py
from periphery import I2C
import time
import numpy as np
import copy
import pickle
i2c = I2C("/dev/i2c-1")
device_address = 0x1A
View gtm.json
{
"requests": {
"1": "\/\/localhost\/amp\/image\/${sample}.jpeg",
"2": "https://www.google-analytics.com/r/collect?v=1&_v=a1&gtm=GTM-N4RJV8M&ds=AMP&aip=true&_s=${requestCount}&dt=${title}&sr=${screenWidth}x${screenHeight}&_utmht=${timestamp}&cid=CLIENT_ID(AMP_ECID_GOOGLE,,_ga)&tid=UA-111111-1&dl=${sourceUrl}&dr=${externalReferrer}&sd=${screenColorDepth}&ul=${browserLanguage}&de=${documentCharset}&jid=${random}&t=pageview&_r=1&a=${pageViewId}&z=${random}&cd1=${sample}",
"3": "\/\/localhost\/amp\/image\/monkey.jpeg?test=%24%7B${ampState%28tabState.index%29}%7D",
"4": "https://www.google-analytics.com/collect?v=1&_v=a1&gtm=GTM-N4RJV8M&ds=AMP&aip=true&_s=${requestCount}&dt=${title}&sr=${screenWidth}x${screenHeight}&_utmht=${timestamp}&cid=CLIENT_ID(AMP_ECID_GOOGLE,,_ga)&tid=UA-111111-1&dl=${sourceUrl}&dr=${externalReferrer}&sd=${screenColorDepth}&ul=${browserLanguage}&de=${documentCharset}&jid=&t=timing&plt=${pageLoadTime}&dns=${domainLookupTime}&tcp=${tcpConnectTime}&rrt=${redirectTime}&srt=${serverResponseTime}
View pintest.py
import RPi.GPIO as GPIO
import time
# Pinout diagram is at https://pinout.xyz/
GPIO.setmode(GPIO.BCM)
#SPI uses BCM 8, 9, 10, 11
#The LCD_Config file initializes 8, 24, 25, 27
View ampwithfont.html
<!doctype html>
<html >
<head>
<meta charset="utf-8">
<link rel="canonical" href="self.html" />
<meta name="viewport" content="width=device-width,minimum-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp-custom>
View jellyfish-amp-msw-select-field-2.json
{ "currProgram": "test",
"items": [{ "programinterests": [ { "name": "PhD in Human and Social Services", "value": "PHDM.W1SSB.HUSS.GEN", "degreeLevel": "Doctral", "areasstudy": "Social Worker", "rn": "hide-me", "rnreq": false, "tempo": "hide-me", "temporeq": false, "selected": "" }, { "name": "PhD in Social Work", "value": "PHD.W1SBS.SWRK.SWA", "degreeLevel": "Doctral", "areasstudy": "Social Worker", "rn": "hide-me", "rnreq": false, "tempo": "hide-me", "temporeq": false, "selected": "" }, { "name": "Doctor of Social Work (DSW)", "value": "DSW.W1SBS.SWRK.ADCP", "degreeLevel": "Doctral", "areasstudy": "Social Worker", "rn": "hide-me", "rnreq": false, "tempo": "hide-me", "temporeq": false, "selected": "" }, { "name": "MS in Human and Social Services", "value": "MS.W1HSS.HUSS.GEN", "degreeLevel": "Masters", "areasstudy": "Social Worker", "rn": "hide-me", "rnreq": false, "tempo": "hide-me", "temporeq": false, "selected": "" }, { "name": "Master of Social Work (MSW)", "value": "MSW.W1SBS.SWRK.APG2", "degreeLevel"
View README.md
@jamesshannon
jamesshannon / #intro.md
Last active Nov 17, 2017 — forked from tomayac/#intro.md
Snippet repository
View #intro.md

There are many code snippets which can be quickly used to show/demo stuff in Chrome for demos or pitches, or just debugging, QA and testing. This is a collection of such snippets with some instructions Snippets can be saved to Chrome and run via one click again!

How to use snippets in Chrome

  • Open Command Menu in DevTools
  • Apple-Shift-P
  • Pick "Create new snippet"
@jamesshannon
jamesshannon / benchmark.php
Last active Dec 16, 2015
Site benchmarking tool. The goal is to provide times that are relevant to hosting a web app (ie, unlike most other benchmarks, it includes MySQL access). Drop into the root of your concrete5 directory and it'll automatically detect your database connection info. If not, update the strings at the top.
View benchmark.php
<?php
$scriptStart = microtime(true);
$iterations = 5000;
$longString = str_repeat('0123456789', 102 * 5); // 10 * 102 * 5 = 5k
if (is_file(dirname(__FILE__) . '/config/site.php')) {
include(dirname(__FILE__) . '/config/site.php');
if (defined('DB_SERVER')) {
@jamesshannon
jamesshannon / site_events.php
Created Dec 21, 2012
Concrete Wall for #concrete5 -- Integration of the core discussion forums addon. This adds wall postings when a user creates a new discussion or replies to an existing one. Add this code anywhere that gets run on every request -- /config/site_events.php is a good place.
View site_events.php
<?php
// register event so that our SiteDiscussionWallPoster::hookPageAdd() gets called when pages get added
Events::extend('on_page_add', 'SiteDiscussionWallPoster', 'hookPageAdd', false);
class SiteDiscussionWallPoster {
/**
* gets called when on_page_add event is fired. adds a wall posting if page of type "discussion_post" was added