This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| redRenders = function () { | |
| $('*').each(function(element){ | |
| $(this).css( "background-color", "red" ); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Code from "Gauss elimination and Gauss Jordan methods using MATLAB" | |
| % https://www.youtube.com/watch?v=kMApKEKisKE | |
| a = [3 4 -2 2 2 | |
| 4 9 -3 5 8 | |
| -2 -3 7 6 10 | |
| 1 4 6 7 2]; | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % This is a modified version of matlab's building rref which calculates | |
| % row-reduced echelon form in gf(2). Useful for linear codes. | |
| % Tolerance was removed because yolo, and because all values | |
| % should only be 0 or 1. @benathon | |
| function [A] = g2rref(A) | |
| %G2RREF Reduced row echelon form in gf(2). | |
| % R = RREF(A) produces the reduced row echelon form of A in gf(2). | |
| % | |
| % Class support for input A: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ o1, o2, o3, o4, o5, o6, o7, o8 ] = split( v ) | |
| %SPLIT Splits a vector of bounded length into individual return variables. | |
| % Split() can handle arbitrarily long input vectors, but only a fixed | |
| % number of output variables. @benathon | |
| % | |
| % Usage: | |
| % vec = [1 2 3 4 5]; | |
| % [a,b,c,d,e] = split(vec); | |
| % [f,g] = split(vec); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| """ This is a proper debounce function, the way a electrical engineer would think about it. | |
| This wrapper never calls sleep. It has two counters: one for successful calls, and one for rejected calls. | |
| If the wrapped function throws an exception, the counters and debounce timer are still correct """ | |
| class Debounce(object): | |
| def __init__(self, period): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This class wraps socket, and will maybe send your packet | |
| # tune tx_drop_rate and rx_drop_rate, 0 means transmit everything, 1 means drop everything | |
| # This class works best for UDP, as it doesn't allow you to drop TCP control messages | |
| import socket | |
| import random | |
| class LossySocket(object): | |
| def __init__(self, *p): | |
| self._sock = socket.socket(*p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| haiku1 = ['A', 'fat', 'bee', 'stings', 'me', 'It', 'hurts', 'very', 'badly', 'but', 'I', 'do', 'not', 'cry', 'though'] | |
| list1 = [9, 11, 6, 14, 1, 10, 12, 0, 3, 4, 8, 5, 7, 13, 2] | |
| haiku2 = [(8, 'feathers'), (2, 'evening'), (5, 'together'), (1, 'peaceful'), (6, 'with'), (0, 'A'), (4, 'singing'), (7, 'pretty'), (3, 'Sparrows')] | |
| haiku3 = 'High and smooth it flew. Into the sky, soaring straight. Flying planes with you.' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if 1: | |
| x1 = -659 | |
| y1 = -10000.0 | |
| x2 = 45 | |
| y2 = -40000.0 | |
| m = (y2-y1)/(x2-x1) | |
| print "slope ", m | |
| b = y2-(m*x2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dashtie | |
| shannon fifo | |
| libevent pipe (under node) | |
| napi helper | |
| static hash | |
| typed arrays in javascript( see https://www.npmjs.com/package/operator-overloading https://github.com/charlieroberts/jsdsp ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| START_LOC = 0x0000; | |
| IMEM_LEN = 0x6400; | |
| DMEM_LEN = 0x1800; | |
| BOOT_LEN = 0x03f8; | |
| PASS_FAIL_LEN = 0x0008; | |
| MEMORY { | |
| imem (R) : ORIGIN = START_LOC , LENGTH = IMEM_LEN | |
| dmem (RW) : ORIGIN = IMEM_LEN , LENGTH = DMEM_LEN | |
| bootloader (RW): ORIGIN = IMEM_LEN + DMEM_LEN , LENGTH = BOOT_LEN |