Skip to content

Instantly share code, notes, and snippets.

View jdiez17's full-sized avatar

José Manuel Díez jdiez17

View GitHub Profile
def long(data, offset, size):
n = 0
for i in range(size):
shft = ((size-i-1)*8)
n |= data[offset+i] << shft
return n
-----BEGIN CERTIFICATE-----
MIIEBTCCAu2gAwIBAgIJAP0uddqDGvvtMA0GCSqGSIb3DQEBBQUAMIGYMQswCQYD
VQQGEwJFUzERMA8GA1UECAwIR2lwdXprb2ExDTALBgNVBAcMBElSVU4xDzANBgNV
BAoMBkV1c2thbDESMBAGA1UECwwJRW5jb3VudGVyMRswGQYDVQQDDBJoYWNraXQu
ZWtwYXJ0eS5vcmcxJTAjBgkqhkiG9w0BCQEWFmp1YW5hbkBkaWFyaW9saW51eC5j
b20wHhcNMTQwNzEyMDg0MjUzWhcNMTUwNzEyMDg0MjUzWjCBmDELMAkGA1UEBhMC
RVMxETAPBgNVBAgMCEdpcHV6a29hMQ0wCwYDVQQHDARJUlVOMQ8wDQYDVQQKDAZF
dXNrYWwxEjAQBgNVBAsMCUVuY291bnRlcjEbMBkGA1UEAwwSaGFja2l0LmVrcGFy
dHkub3JnMSUwIwYJKoZIhvcNAQkBFhZqdWFuYW5AZGlhcmlvbGludXguY29tMIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2554w65KJ43nIri89/R+sluw
>>> dis.dis(chk_serial)
32 0 LOAD_GLOBAL 0 (b)
3 LOAD_FAST 0 (s)
6 CALL_FUNCTION 1
9 POP_JUMP_IF_FALSE 22
12 LOAD_GLOBAL 1 (a)
15 LOAD_GLOBAL 2 (F)
18 CALL_FUNCTION 1
21 RETURN_VALUE
>> 22 LOAD_CONST 1 ('Fail')
void in_received_handler(DictionaryIterator* received, void* ctx) {
Tuple* data = dict_read_first(received);
while(data) {
switch(data->key) {
case KEY_UTC_OFFSET:
utc_offset = (time_t) data->value->int32;
persist_write_int(KEY_UTC_OFFSET, utc_offset);
break;
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 52e6832..d6b9da9 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -76,7 +76,7 @@
#endif
// Define this to set a custom name for your generic Mendel,
-// #define CUSTOM_MENDEL_NAME "This Mendel"
+#define CUSTOM_MENDEL_NAME "Kossel"
module Sudoku where
import Data.List (intersperse, nub, transpose, (\\), minimumBy)
import Control.Applicative ((<$>))
import Control.Monad (sequence, mapM, guard)
type Position = (Int, Int)
{- D0 is "Unknown" -}
data Digit = D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9
module Sudoku where
import Data.List (intersperse, nub, transpose, (\\), minimumBy)
import Control.Applicative ((<$>))
import Control.Monad (sequence, mapM, guard)
type Position = (Int, Int)
{- D0 is "Unknown" -}
data Digit = D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9
itemsInSquare :: Sudoku -> Position -> [Digit]
itemsInSquare (Sudoku rows) (Position x y) = [y'..y'+2] >>= (\idx -> take 3 $ drop x' $ rows !! idx)
where x' = x - x `mod` 3
y' = y - y `mod` 3
module Sudoku where
import Data.List (intersperse, nub, transpose, (\\))
import Control.Applicative ((<$>))
import Control.Monad (sequence, mapM, guard)
data Position = Position Int Int
{- D0 is "Unknown" -}
data Digit = D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9
module Sudoku where
import Control.Monad (sequence)
data Digit = D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9
deriving (Eq, Ord, Read, Enum)
mkDigit :: Int -> Maybe Digit
mkDigit n
| n > 0 && n < 10 = Just $ toEnum (n-1)