Skip to content

Instantly share code, notes, and snippets.

/*
* Author: [email protected]
* libbcm2835 documentation: http://www.airspayce.com/mikem/bcm2835/index.html
*/
#include <bcm2835.h>
#include <iostream>
#include <ctime>
using namespace std;
p=<1500,413,-535>, v=<-119,22,36>, a=<-5,-12,3>
p=<65,1223,-530>, v=<-14,-136,52>, a=<2,2,0>
p=<260,-387,800>, v=<49,14,-103>, a=<-13,4,4>
p=<429,726,462>, v=<-36,-36,-19>, a=<0,-6,-4>
p=<1705,-165,1331>, v=<-134,9,-104>, a=<-3,0,-3>
p=<341,693,-473>, v=<-28,9,-18>, a=<0,-13,10>
p=<2816,-2250,1464>, v=<-91,41,149>, a=<-4,6,-20>
p=<-1237,-1704,-531>, v=<47,125,35>, a=<1,-4,-1>
p=<-4828,-171,-447>, v=<86,8,-24>, a=<13,0,4>
p=<2553,3286,-5524>, v=<-128,45,41>, a=<3,-9,8>
p=<-3787,-3683,3352>, v=<41,-25,-124>, a=<5,9,1>
p=<6815,2269,3786>, v=<-93,23,38>, a=<-8,-6,-10>
p=<-1586,-5016,3166>, v=<2,66,-70>, a=<3,6,-2>
p=<-2392,-397,3538>, v=<76,-19,-114>, a=<0,2,0>
p=<1669,1370,376>, v=<41,68,-28>, a=<-6,-7,1>
p=<-3601,3943,-6010>, v=<35,-79,-30>, a=<5,-3,14>
p=<1235,3943,-771>, v=<-57,-31,41>, a=<1,-6,-1>
p=<-1925,-314,1287>, v=<80,16,-73>, a=<1,0,1>
p=<3325,5104,720>, v=<-5,-55,-68>, a=<-14,-17,3>
p=<-1841,1744,615>, v=<76,61,-8>, a=<1,-13,-2>
p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4
p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0> (0)(1)
p=< 4,0,0>, v=< 1,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4
p=< 2,0,0>, v=<-2,0,0>, a=<-2,0,0> (1) (0)
p=< 4,0,0>, v=< 0,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4
p=<-2,0,0>, v=<-4,0,0>, a=<-2,0,0> (1) (0)
p=< 3,0,0>, v=<-1,0,0>, a=<-1,0,0> -4 -3 -2 -1 0 1 2 3 4
@Ummon
Ummon / toRoman.fsx
Created November 10, 2017 21:23
Transform an integer to a roman numeral
#!/usr/bin/env fsharpi
let elements = [ "M", 1000; "CM", 900; "D", 500; "CD", 400; "C", 100; "XC", 90; "L", 50; "XL", 40; "X", 10; "IX", 9; "V", 5; "IV", 4; "I", 1 ]
let rec toRomanNumber (v : int) : string =
if v >= 1 then
let e, v' = elements |> List.find (snd >> (>=) v)
e + toRomanNumber (v - v')
else
""
@Ummon
Ummon / Program.fs
Created October 8, 2015 15:42
Module 2 - Problem
open System
let rec readAge () : int =
printf "Age: "
match Int32.TryParse(Console.ReadLine()) with
| true, age when age > 0 -> age
| _ ->
printfn "Cannot read the age, please retry.."
readAge ()
@Ummon
Ummon / Program.cs
Last active December 22, 2015 05:09
IntString
using System;
namespace ExperimentationsCSharp
{
public struct IntString : IEquatable<IntString>, IComparable<IntString>
{
int value;
public IntString(int v)
{
@Ummon
Ummon / NewtworkManagerConnection.cs
Created December 17, 2012 10:18
To control the Network Manager on Ubuntu with DBUS and C#/Mono. D-BUS documentation: * The D-BUS Network Manager: http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Settings.Connection * The D-BUS C# free library: https://github.com/mono/dbus-sharp and http://www.ndesk.org/DBus_Documentation * D-B…
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using DBus;
namespace IPChangerPrototype
{
public enum Method
@Ummon
Ummon / gist:3907996
Created October 17, 2012 20:36
Qt Creator 2.6RC says “expected token `;’ got `{‘
QList<QList<File*>*> fileLists { &this->filesWithoutHashesPrioritized, &this->filesWithoutHashes };
@Ummon
Ummon / gist:3754848
Created September 20, 2012 09:15
Haskell > Scala (2)
countChange :: Int -> [Int] -> Int
countChange 0 _ = 1
countChange _ [] = 0
countChange money coins@(x:xs)
| money < 0 = 0
| otherwise = (countChange money xs) + (countChange (money - x) coins)