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
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 / 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
@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)
"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 / 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"
#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 / 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
{
@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 / showclue.py
Created March 21, 2020 18:02
A small snippet regarding getting the Clue and the Elecfreaks Joystick:Bit working together.
from adafruit_clue import clue
import board
from analogio import AnalogIn
clue.sea_level_pressure = 1020
ap0=AnalogIn(board.P0)
ap1=AnalogIn(board.P1)
ap2=AnalogIn(board.P2)
clue_data = clue.simple_text_display(title="CLUE Sensor Data!", title_scale=2)
@codepope
codepope / reckoner.sh
Created August 24, 2020 12:07
Finds a Fly app name in the local directory's fly.toml and destroys without mercy
#!/bin/bash
regex='^app = "([^"]*)"'
while read line
do
if [[ $line =~ $regex ]]
then
appname="${BASH_REMATCH[1]}"
flyctl destroy $appname -y
exit