Skip to content

Instantly share code, notes, and snippets.

View death667b's full-sized avatar

Ian Daniel death667b

  • Brisbane, Australia
View GitHub Profile
@death667b
death667b / quick_sort.py
Last active November 5, 2017 06:47
Playing with python3 - just a simple quick sort algo. This code has 6 basic operations for 15 numbers in the array.
"""
Quick Sort algo in Python3
"""
def quick_sort(arr):
"""
quick_sort sorts an array of integers.
"""
if len(arr) <= 1:
return arr
@death667b
death667b / findNumber.js
Last active September 7, 2017 02:15
find a number in range - log n problem
function findNumber(minN, maxN, findMe, opNum = 0) {
// O(log n)
// if inital maxN is ... then there will be ... operations
// 100 ~6 ops
// 1,000 ~9 ops
// 10,000 ~13 ops
// 100,000 ~16 ops
// 100,000,000 ~26 ops
// 100,000,000,000 ~36 ops
// 100,000,000,000,000 ~46 ops
@death667b
death667b / __MAGIKCRAFT__.death667b.package_json.md
Last active July 23, 2017 04:47
Magikcraft API: package_json files, by death667b.
@death667b
death667b / __MAGIKCRAFT__.death667b.magikcraft_spells.md
Last active July 23, 2017 03:28
Magikcraft Spells, by death667b.
const magik = magikcraft.io;
function EDIT_THIS() {
}
const magik = magikcraft.io;
function EDIT_THIS() {
}
module.exports = function(hljs) {
var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
var KEYWORDS = {
keyword:
'in of if for while finally var new function do return void else break catch ' +
'instanceof with throw case default try this switch continue typeof delete ' +
'let yield const export super debugger as async await static ' +
// ECMAScript 6 modules import
'import from as'
,
"use strict";
(function() {
Error.stackTraceLimit = Infinity;
var $global, $module;
if (typeof window !== "undefined") { /* web page */
$global = window;
} else if (typeof self !== "undefined") { /* web worker */
$global = self;
/*
// March 2014 - TMRh20 - Updated along with High Speed RF24 Library fork
// Parts derived from examples by J. Coliz <maniacbug@ymail.com>
*/
/**
* Example for efficient call-response using ack-payloads
*
* This example continues to make use of all the normal functionality of the radios including
* the auto-ack and auto-retry features, but allows ack-payloads to be written optionally as well.
* This allows very fast call-response communication, with the responding radio never having to
var spiDev = "/dev/spidev0.0";
var cePin = 8;
var irqPin = 5;
var pipes = [0xABCDABCD71, 0x544d52687C];
var nrf = require('nrf');
var radio = nrf.connect(spiDev, cePin, irqPin); // Connect to the radio
radio.channel(0x4c); // Set channel to 76
radio.transmitPower('PA_LOW');
radio.dataRate('1Mbps') // Set data rate to 1Mbps