Skip to content

Instantly share code, notes, and snippets.

View chappjc's full-sized avatar
🏁

Jonathan Chappelow chappjc

🏁
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<div id="updates"></div>
<script src="https://alpha.dcrdata.org/js/socket.io.slim.js"></script>
<script>
var socket = io('https://alpha.dcrdata.org', {path: '/insight/socket.io', transports: ['websocket'], upgrade: false});
@chappjc
chappjc / socket.html
Created May 18, 2018 22:58 — forked from oluwandabira/socket.html
Test page that connects to the insight socket.io backend and logs new transactions and blocks.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script src="http://localhost:7777/js/socket.io.slim.js"></script>
<script>
var socket = io('http://localhost:7777', {path: '/insight/socket.io', transports: ['websocket'], upgrade: false});
//var socket = io('https://mainnet.decred.org/')

Keybase proof

I hereby claim:

  • I am chappjc on github.
  • I am chappjc (https://keybase.io/chappjc) on keybase.
  • I have a public key whose fingerprint is 761D 6A0B EB28 6C9B 6A65 DD05 3F85 7EEA 746C 64D1

To claim this, I am signing this object:

@chappjc
chappjc / handler.go
Created March 23, 2017 00:40 — forked from rjz/handler.go
Handle Github webhooks with golang
// Now available in package form at https://github.com/rjz/githubhook
package handler
// https://developer.github.com/webhooks/
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"errors"
@chappjc
chappjc / jsonarray2csv.sh
Created February 24, 2017 00:29
convert JSON array to CSV
#!/bin/bash
in=`tee`
# echo $in
echo $in | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' > $1
#!/bin/sh
/usr/local/letsencrypt/certbot-auto renew --noninteractive --standalone \
--pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" \
--renew-hook "touch /etc/nginx/ssl/certsrenewed" --quiet --no-self-upgrade
EXITVAL=$?
if [ $EXITVAL -ne 0 ]; then
/usr/bin/logger -t certbot "certbot-auto exited abnormally with $EXITVAL"
exit $EXITVAL
fi
@chappjc
chappjc / c_cpp_properties.json
Created January 17, 2017 23:25
VS Code C++ project properties for VS 2015 w/ Windows SDK 10.0
{
"configurations": [
{
"name": "Mac",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
@chappjc
chappjc / tasks-alt.json
Created June 11, 2016 17:19
Golang tasks for Visual Studio Code - 1
{
"version": "0.1.0",
"command": "bash",
"isShellCommand": true,
"showOutput": "always",
"args": [
"-c"
],
"tasks": [
{
@chappjc
chappjc / dcrbuild.sh
Last active May 1, 2020 21:58
Decred build script using dep for both dcrd and dcrwallet
#!/usr/bin/env bash
# Build dcrd and dcrwallet from git.
# It will clone master initially; subsequently it will pull any checked out branch.
# chappjc
go version
GO111MODULE=on go get -v decred.org/dcrctl@master
# Inital setup for dcrd build with dep requries manual clone
@chappjc
chappjc / pylon_mex_camera_interface.cpp
Last active November 18, 2021 20:24
Add comments/documentation. Append checkHandle() and getHandle() definitions.
// pylon_mex_camera_interface.cpp
// Code for StackOverflow Q&A: http://stackoverflow.com/a/32529850/2778484
// by Jon Chappelow (chappjc)
// For example MATLAB-side implementation (class wrapper), see https://github.com/chappjc/MATLAB/tree/master/cppClass
// Use:
// 1. Enumerate the different actions (e.g. New, Delete, Insert, etc.) in the
// Actions enum. For each enumerated action, specify a string (e.g.
// "new", "delete", "insert", etc.) to be passed as the first argument to
// the MEX function in MATLAB.