Skip to content

Instantly share code, notes, and snippets.

View andreabedini's full-sized avatar

Andrea Bedini andreabedini

View GitHub Profile

title: Function all the way down. Programming in λ calculus. author: Andrea Bedini ...

Hello

  • @andreabedini (GitHub ✅, Facebook ✗, Twitter ✗)
  • Data Scientist @Fortescue by day
  • Programming languages nerd
@andreabedini
andreabedini / get_secret.py
Created December 4, 2019 05:42
Easily access AWS Secret Manager from Python
# Use this code snippet in your app.
# If you need more information about configurations or implementing the sample code, visit the AWS docs:
# https://aws.amazon.com/developers/getting-started/python/
import json
import boto3
import base64
from botocore.exceptions import ClientError
@andreabedini
andreabedini / lambda-runtime-mock.hs
Created May 18, 2019 07:59
Mocking the service-side of AWS Lambda runtime (useful to test you own runtime implementations)
module Main (main) where
import Control.Concurrent (newChan, readChan, writeChan)
import Control.Monad.IO.Class (liftIO)
import Data.Text (Text)
import Web.Scotty
main :: IO ()
main = do
@andreabedini
andreabedini / parsers.fs
Created May 17, 2019 14:00
Parsers in F#
open System
// "A parser for things is a function from strings to list of pairs of things and strings"
type 'a Parser = string -> ('a * string) list
// What the rhyme means is that a parser for a type (e.g. integers) turns an input string
// (e.g. "11/05/2019") into a list of matches together with the remaining unconsumed input
// (e.g. [(11, "/05/2019")]). In this formultion running a parser over an input strings means
// apply the parser function to the input.
@andreabedini
andreabedini / Main.hs
Created February 20, 2019 05:09
Experimenting with Reflex at the PerthFP meetup (18/02/2019)
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Aeson
import qualified Data.Text as T
import Language.Javascript.JSaddle.Warp
import Reflex.Dom.Core
import Reflex.Dom.Xhr
@andreabedini
andreabedini / gist:c76d07243656c420378d
Created August 31, 2015 10:05
list of places pytables uses C long types
hdf5extension.pyx-1133- """
hdf5extension.pyx-1134-
hdf5extension.pyx-1135- cdef void *t64buf
hdf5extension.pyx:1136: cdef long byteoffset, bytestride, nelements
hdf5extension.pyx-1137- cdef hsize_t nrecords
hdf5extension.pyx-1138-
hdf5extension.pyx-1139- byteoffset = 0 # NumPy objects doesn't have an offset
--
--
indexesextension.pyx-619- def _init_sorted_slice(self, index):
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
<ipython-input-8-7369931b6968> in <module>()
2
3 index = pd.timedelta_range(start="06:00:01", end="12:00:00", freq='S')
----> 4 pd.Series(range(index.size), index=index).plot()
/usr/local/lib/python3.4/site-packages/pandas/tools/plotting.py in plot_series(data, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)
2517 yerr=yerr, xerr=xerr,
2518 label=label, secondary_y=secondary_y,
diff --git a/ptrepack.dump b/h5repack.dump
index 086f972..92d1acf 100644
--- a/ptrepack.dump
+++ b/h5repack.dump
@@ -1,4 +1,4 @@
-HDF5 "ptrepack.h5" {
+HDF5 "h5repack.h5" {
GROUP "/" {
ATTRIBUTE "CLASS" {
DATATYPE H5T_STRING {
import System.Random
import Control.Monad.Random
import qualified Data.Map.Lazy as Map
import Data.Map.Lazy (Map)
import Data.Maybe
import Data.Traversable as T
-- for the moment consider this a constant
max_speed = 2
@andreabedini
andreabedini / keybase.md
Created February 25, 2015 22:53
keybase.md

Keybase proof

I hereby claim:

  • I am andreabedini on github.
  • I am andreabedini (https://keybase.io/andreabedini) on keybase.
  • I have a public key whose fingerprint is 17D5 FB49 FA18 A068 CF53 C5C2 9503 64C1 B2D5 9591

To claim this, I am signing this object: