Skip to content

Instantly share code, notes, and snippets.

View theSeafarer's full-sized avatar

Parhām theSeafarer

View GitHub Profile
@theSeafarer
theSeafarer / Main.hs
Created October 2, 2018 00:03
Stupid JSON pretty-printer thingy
{-# LANGUAGE TypeApplications #-}
module Main where
import System.Environment
import Data.Aeson
import Data.Aeson.Encode.Pretty
import Data.Maybe ( fromJust )
import qualified Data.ByteString.Lazy as LBS
@theSeafarer
theSeafarer / Adv1.hs
Created December 1, 2018 21:27
Advent of Code 2018, Day 1
-- I don't know if I'm gonna continue doing Advent of Code till the end,
-- but I felt that I should share with the world, the horror that is this module's `main`
module Adv1 where
import qualified Data.IntSet as S
partOne :: [Int] -> Int
partOne = sum
partTwo :: [Int] -> Int
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import qualified System.Posix.Memory as M
import qualified System.Posix.Types as P
import qualified Foreign as F
import qualified Foreign.C as F
import qualified Foreign.C.Error as F
import qualified Foreign.Storable as F
import System.IO.Error
module Main where
import System.Environment ( getArgs )
import System.FSNotify
import System.FilePath.Posix ( takeFileName )
import System.Process ( spawnProcess )
import Control.Monad ( forever, void )
import Control.Concurrent ( threadDelay )
main :: IO ()
@theSeafarer
theSeafarer / OsmMap.kt
Created June 28, 2023 20:30
A quick and dirty solution to use [osmdroid/osmdroid]'s MapView in Jetpack Compose.
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.Lifecycle