Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
module ADT where | |
import Prelude hiding (Bool, True, False, | |
negate, and, or, | |
List, Cons, Nil, | |
Maybe, Just, Nothing, | |
Either, Left, Right, | |
Tree, Node, Leaf) | |
-- Simplest ADT |
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
-- Much better | |
foo :: Int -> Int -> Int | |
foo x acc = if acc `mod` x == 0 then acc else lcm acc x | |
mult20 = foldr foo 1 [1..20] | |
-- 1st try | |
primes = [2 :: Integer, 3, 5, 7, 11, 13, 17, 19] | |
isInt x = (x :: Double) == fromInteger (round x) | |
power p x = length $ takeWhile id $ drop 1 $ map isInt $ iterate (/ fromInteger p) $ fromInteger x | |
mult20 = foldr (*) 1 $ zipWith (^) primes $ map maximum $ map (\p -> map (power p) [1..20]) primes |
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
// Compiles with gcc -O0 single_diff_libswiftnav.c | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <inttypes.h> | |
typedef uint8_t u8; | |
typedef uint16_t u16; |
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
/** Brief description which ends at this dot. | |
* Details follow here. | |
* | |
* \todo Fix the bugs | |
* | |
* \param a Description of first argument | |
* \param b Description of second argument | |
* \return Descripton of the return value | |
*/ | |
float lolz(int a, int b) |
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 gist has been moved into libsbp: | |
# https://github.com/swift-nav/libsbp/blob/master/python/sbp/client/examples/simple.py |
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 pandas | |
wp = pandas.Panel(randn(2, 5, 4), items=['Item1', 'Item2'], | |
major_axis=pandas.date_range('1/1/2000', periods=5), | |
minor_axis=['A', 'B', 'C', 'D']) | |
wp2 = pandas.Panel(randn(3, 5, 4), items=['Item1', 'Item2', 'Item3'], | |
major_axis=pandas.date_range('1/1/2000', periods=5), | |
minor_axis=['A', 'B', 'C', 'D']) | |
wp.sub(wp2).ix[:, :, '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
#define TAU_CROSSOVER 0.5 | |
#define TAU_BIAS (TAU_CROSSOVER*10) | |
#define A (1e-3/TAU_CROSSOVER) | |
#define B (1e-3/TAU_BIAS) | |
double dll_update = chan->dll_pgain*(chan->dll_disc-dll_disc_prev) + chan->dll_igain*chan->dll_disc; | |
double pll_update = (1.023e6/L1_HZ)*(chan->pll_pgain*(chan->pll_disc-pll_disc_prev) + chan->pll_igain*chan->pll_disc); | |
// Original: |