This file contains 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
#include <SPI.h> | |
#include <SD.h> | |
#define ADDRLO_PORT PORTA | |
#define ADDRHI_PORT PORTC | |
#define DATA_PORT PORTD | |
#define MREQ_PIN PB0 | |
#define WR_PIN PB1 | |
#define RD_PIN PB2 | |
#define WAIT_PIN PB3 |
This file contains 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
#!/usr/bin/env bash | |
# Copyright 2018 Ata Can Kuyumcu | |
# 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 furnished to do | |
# so, subject to the following conditions: |
This file contains 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
(for [i 1 100] | |
(if (= 0 (% i 3)) | |
(if (= 0 (% i 5)) | |
(print "fizzbuzz") | |
(print "fizz")) | |
(= 0 (% i 5)) | |
(print "buzz") | |
(print i))) |
This file contains 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
#!/bin/bash | |
FUEL_COST=5 | |
FOOD_COST=2 | |
START_FUEL=50 | |
START_FOOD=70 | |
START_PARTS=2 | |
START_CREW_SIZE=4 |
This file contains 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
#!/usr/bin/env python3 | |
from sympy import lambdify | |
from itertools import count | |
n_decimal_digits = lambda value, n: format(value, ".%df" % (n+1))[:-1] | |
sign = lambda x: x / abs(x) | |
function = lambdify("x", input("Enter an expression to find a root for: ")) | |
digit_target = int(input("Enter the number of digits to match: ")) |
This file contains 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
#!/usr/bin/env python3 | |
from sympy import lambdify | |
from itertools import count | |
function = lambdify("x", input("Enter a method to iterate with: ")) | |
initial_value = float(input("Enter the initial value for the iteration: ")) | |
target_diff = float(input("Enter the target value for the difference between iterations: ")) | |
value = initial_value |
This file contains 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
(defn fib | |
([] (fib 1 1)) ; start with x = y = 1 | |
([x y] (lazy-seq (cons x (fib y (+ x y)))))) ; x = y and y = x + y | |
(println (reduce + (filter even? | |
(take-while #(< % 4000000) (fib))))) |
This file contains 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
sum, x, y, z = 0, 1, 2, 3 | |
while z <= 4000000 | |
z = x + y | |
x = y | |
y = z | |
sum += z if z.divisible_by? 2 | |
end | |
puts sum |
This file contains 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
sum = 0 | |
(1..1000).each { |number| | |
if (number.divisible_by? 3) || (number.divisible_by? 5) | |
sum += number | |
end | |
} | |
puts sum |
This file contains 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
(println (reduce + | |
(filter #(= (* (mod % 3) (mod % 5)) 0) | |
(range 1 1000)))) |