Skip to content

Instantly share code, notes, and snippets.

View codepope's full-sized avatar
:shipit:
London, Cor Blimey Guvn'r

Dj Walker-Morgan codepope

:shipit:
London, Cor Blimey Guvn'r
View GitHub Profile
@codepope
codepope / SerpentePulse.py
Last active November 19, 2019 12:57
Pulses the Serpente's single RGB LED through various colours
import time
import board
import pulseio
ledr = pulseio.PWMOut(board.LED_R, frequency=5000, duty_cycle=0)
ledg = pulseio.PWMOut(board.LED_G, frequency=5000, duty_cycle=0)
ledb = pulseio.PWMOut(board.LED_B, frequency=5000, duty_cycle=0)
leds=[ ledr, ledg, ledb ]
while True:
@codepope
codepope / CSharpTransactions.cs
Last active April 26, 2024 06:55 — forked from RWaltersMA/CSharpTransactions.cs
Updated Example C# code showing MongoDB Transactions using the MongoDB .NET Driver (2.7+)
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System;
using System.Threading.Tasks;
namespace MongoDBTransaction
{
public static class Program
{
#include <M5Stack.h>
#include "FastLED.h"
#define Neopixel_PIN 21
#define NUM_LEDS 37
CRGB leds[NUM_LEDS];
uint8_t gHue = 0;
uint8_t pixel = 18;
@codepope
codepope / Frireworks.ino
Created November 17, 2018 08:33
Fireworks for ESP32+Featherwing TFT
/***************************************************
Fireworks - A simple touch fireworks demo
Based on code written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <SPI.h>
#include "Adafruit_GFX.h"
"use strict";
/* jshint node:true */
// Add the express web framework
const express = require("express");
const app = express();
const { URL } = require("url");
// Use body-parser to handle the PUT data
const bodyParser = require("body-parser");
@codepope
codepope / christmas2.py
Created November 25, 2017 16:08
For the Pihut christmas tree...
from gpiozero import LEDBoard
from time import sleep
from signal import pause
treelights=[ 18, 5, 9, 11, 21, 10, 7, 12, 6, 1,14, 3, 20, 24, 13, 15,2, 17, 16, 23,8, 22, 4, 19 ]
treemap={ 1:4, 7:5, 16:6, 22:7, 6:8 , 14:9, 8:10, 21:11, 15:12, 3:13, 19:14, 2:15, 9:16, 10:17, 20:18, 18:19,17:20, 4:21, 24:22, 23:23, 13:
24, 5:25, 12:26, 11:27
}
leds=LEDBoard(*range(4,28), pwm=True)
@codepope
codepope / gogogadget.sh
Last active November 25, 2017 11:16
Go go Gadget Pi -= Make a Raspbian sd card and with the /boot mounted, run this to do that gadget enabling
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No directory given to gogogadget!"
exit
fi
EDITDIR=$1
echo "Gogogadgeting files in $EDITDIR"
echo "Adding dtoverlay to $EDITDIR/config.txt"
echo "dtoverlay=dwc2" >>$EDITDIR/config.txt
Region Name Prefix API Endpoint
US South/Dallas/us-south bmix-dal https://composebroker-dashboard-public.mybluemix.net
United Kingdom/London/eu-gb bmix-lon https://composebroker-dashboard-public.eu-gb.mybluemix.net
Germany/eu-de bmix-eude ttps://composebroker-dashboard-public.eu-de.mybluemix.net
Sydney/au-syd bmix-syd https://composebroker-dashboard-public.au-syd.mybluemix.net
@codepope
codepope / python_mongodb_example.py
Created August 8, 2017 13:34
A grandtour example of on the fly db creation.
from flask import Flask
from flask import render_template
from flask import request
import os
from urllib.parse import urlparse
import json
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
@codepope
codepope / HowToOTGFast.md
Created March 21, 2017 18:36 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is