Skip to content

Instantly share code, notes, and snippets.

View 46bit's full-sized avatar
🏳️‍🌈

Miki Mokrysz 46bit

🏳️‍🌈
View GitHub Profile

Keybase proof

I hereby claim:

  • I am 46bit on github.
  • I am 46bit (https://keybase.io/46bit) on keybase.
  • I have a public key whose fingerprint is 8866 3A0E CFCF 0786 D478 1D9D 8DA9 2997 13A7 9B14

To claim this, I am signing this object:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include "postman.h"
int main(int argc, char *argv[], char **envp)
{
// Parse AIs from stdin or command-line arguments.
int i, ai_count = argc - 1;
struct game {
struct character *characters_head, *characters_tail;
struct player *players_head, *players_tail;
struct round *rounds_head, *current_round, *rounds_tail;
};
struct round {
struct card *cards_head, *current_card, *cards_tail;
struct player *start_player, *current_player;
struct move *current_move;
match "posts/*.md" $ do
route $ metadataRoute (\m ->
constRoute $
(fromMaybe "year" $ Data.Map.lookup "year" m) ++
"/" ++
(fromMaybe "title" $ Data.Map.lookup "title" m) ++
".html")
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
data State = State { name :: Int
, transitions :: [Transition]
, accepting :: Bool
} deriving (Show)
data Transition = Transition { input :: Char
, next :: State} deriving (Show)
accept :: String -> Maybe State -> Bool
accept _ Nothing = False
accept [] (Just State {accepting = a}) = a
@46bit
46bit / tm.hs
Last active August 29, 2015 14:02
Turing Machine in Haskell.
module TM (
State,
Symbol,
Direction(..),
Transition,
ZipTape,
TM,
prettyTransition,
prettyZipTape,
prettyTM,
@46bit
46bit / test.hs
Last active August 29, 2015 14:02
Tiny demo of my Haskell Turing Machine (https://gist.github.com/46bit/46fba4b32db68a5f47c9)
import TM
import Data.Maybe
main :: IO ()
main = print . TM.prettyTM . TM.executeTM $
TM.createTM "bbc" [(0, 'a', 'b', TM.Idle, 1), (1, 'b', 'c', TM.Right, 1)]
@46bit
46bit / uarm-issues.md
Last active August 29, 2015 14:03
Issues experienced with µArm, for use when designing improved firmware and hardware.

µArm issues

Firmware

  1. Resets unpredictable during movement series (such as hanoi.c).
  2. Pushes servos into mechanically limited positions.
  3. No collision detection despite servo position feedback, sucker contact button.
  4. No state display on LEDs.
  5. Servos move at high speed, stressing mechanism and overcoming base friction.
  6. Position based around servo settings rather than head position. Stretch and height coordinates are not independent.
  7. Many serial libraries don't function (eg RubySerial), forced to use specialised arduino-serial library.
@46bit
46bit / gist:5db76cde9c48bfa31039
Last active August 29, 2015 14:05
Things to remind myself about the Highway Code
break for 15+ minutes every 2 hours
limit on towing weight
do not use horn when stationary or 11:30pm-7am in built-up area
sidelights and rear registration must be lit half an hour either side of sunset/sunrise
headlights must be lit at night unless there are streetlights
when stationary, apply the parking brake and release the foot brake to reduce dazzle
use dipped headlights in daytime, built-up areas, overtaking until level
hazard warning lights should be used at night in built-up areas, or dull daytime
start/stop braking lightly, for safety
try to avoid wheellock in emergency brake
#include <stdio.h>
#include <stdlib.h>
#include <openssl/ec.h>
//#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
int main()
{
BN_CTX *bn_ctx = BN_CTX_new();