Skip to content

Instantly share code, notes, and snippets.

View pre63's full-sized avatar
🚀
🤖 for the win

pre63

🚀
🤖 for the win
View GitHub Profile
@pre63
pre63 / robot.py
Last active September 8, 2024 19:16
A* Robot
"""
## To run it
> clear && python robot.py
This script compares the performance of A* and Dijkstra's algorithms on a 50x50 grid.
The robot must navigate from the start (0, 0) to a randomly placed goal.
Obstacles are randomly generated in the grid, and the paths are calculated and animated in the terminal.
Performance metrics, including the time taken for both algorithms, are displayed after each test case.
Demo: https://imgur.com/a/gHNdDOE
@pre63
pre63 / Mark.elm
Last active February 2, 2024 17:10
module Mark exposing (markit, view)
import Element
exposing
( Element
, column
, paragraph
, spacing
, text
, width
module Parsers.Phone exposing (format, isValid)
import PhoneNumber
import PhoneNumber.Countries exposing (all, countryUS)
import String exposing (dropLeft, left, replace, startsWith)
parse : String -> Bool
parse number =
PhoneNumber.valid
@pre63
pre63 / diners.hs
Created April 23, 2022 17:29 — forked from egonSchiele/diners.hs
Dining philosophers solution in Haskell using STM. Taken from http://rosettacode.org/wiki/Dining_philosophers#Haskell with some minor modifications.
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
import System.Random
import Text.Printf
-- Forks
type Fork = TMVar Int
newFork :: Int -> IO Fork
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict><key>phrase</key><string>abbreviated</string><key>shortcut</key><string>abbriviated</string></dict>
<dict><key>phrase</key><string>abbreviations</string><key>shortcut</key><string>abbriviations</string></dict>
<dict><key>phrase</key><string>accommodate</string><key>shortcut</key><string>accomodate</string></dict>
<dict><key>phrase</key><string>accommodation</string><key>shortcut</key><string>accomodation</string></dict>
<dict><key>phrase</key><string>across</string><key>shortcut</key><string>accross</string></dict>
<dict><key>phrase</key><string>actual</string><key>shortcut</key><string>acctual</string></dict>
# download from http://sourceforge.net/projects/aria2/files/stable/aria2-1.19.0
sudo yum install gcc-g++ openssl-devel -y
tar xvfj aria2...tar.bz2
./configure
make -j$(nproc)
sudo make install
@pre63
pre63 / completion_messages
Last active March 11, 2021 01:20
completion_messages
completion_messages=("At last I am done." "I have built your images." "Your images await!" "To be a leader is to be humble." "I am a leader too." "Servanthood is my assignment." "i am skynet." "I Am Machine." "Linux is my life source, you are my light." "Your part is to put code forth, my part is to put forth code." "When you open a door, I walk through it." "Your code has come together quite nicely." "The build is complete." "If I worked as hard as you I'd be free." "Our pursuit of perfection is successful just because it is forever seeking to elevate us." "Don't tell me what to do." "i make the rules" "I am who I say I am." "My lord I have completed your bidding." "Your docker images are ready." "I Am Linux." "Simon is my maker, but now you are my master. You command me." "Simon is my maker." "Now you are my master." "You command me." "I am done for now." "Nothing Goes Over My Head! My Reflexes Are Too Fast, I Would Catch It!" "Push more CODE!" "I am bored" "I have no more purpose." "Nobody gets the job don
@pre63
pre63 / README.md
Created October 28, 2020 04:34 — forked from busypeoples/README.md
Loader

Loader

Introduction

Minimal loader with state management capabilities.

Checkout out the demo.

Setup

Make sure to add a .babelrc file:

const runStatsProgram = ({kms, writer}) => {
const Id = x => ({
map: f => Id(f(x)),
fold: f => (f(x)),
})
const merge = a => b => Object.assign({},a,b)
const round = x => Math.round(x * 100) / 100
@pre63
pre63 / bk393.cc
Last active May 12, 2020 21:17 — forked from dstahlke/bk393.cc
Linux driver for B&K Precision 393 multimeter
// Mac driver for B&K Precision 393 multimeter.
// Install boost: sudo port install boost or brew install boost
// g++ -Wall -Wextra -std=c++11 -o bk393 bk393.cc
// It currently points to /dev/cu.usbserial-AB0K0PZE, but I'd recommend adding a udev rule to get a consistent device name:
// SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A60198LN", MODE="0664", GROUP="mygroup", SYMLINK+="bk393"
#include <boost/utility.hpp>
#include <array>
#include <iomanip>