Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@audioplastic
audioplastic / main.py
Created February 22, 2021 13:56
Pi Pico test script to calculate primes and report status in built in LED every 20 seconds
from machine import Pin, Timer
import utime, math
led = Pin(25, Pin.OUT)
tim = Timer()
pIdx = 0;
x = 0;
latestPrime=0;
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
@audioplastic
audioplastic / anagram_stats.cpp
Created February 11, 2016 02:44
Breakdown statistics of all of the anagrams in a language file using alphabetised hashing
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <map>
int main(int argc, char *argv[])
{
std::ifstream file("words.txt");
@audioplastic
audioplastic / nicks_observer.cpp
Created November 29, 2012 23:56
Super simple single threaded observer pattern for C++11
// C++11 style observer pattern implementation using lambda for scoped
// connection management.
//
// Copyright (c) 2012 Nick C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@audioplastic
audioplastic / poetry1.cpp
Created November 29, 2012 21:32
Test gist showing some C++11 niceness
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> v{12,324,45,65,787,9}; //Uniform initialization
cout << "In vector: ";
for (auto val : v) {cout << val << ", ";} //Range based for
int m = 5;