Skip to content

Instantly share code, notes, and snippets.

View andreabedini's full-sized avatar
☺️

Andrea Bedini andreabedini

☺️
View GitHub Profile
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 {
---------------------------------------------------------------------------
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,
@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):
@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 / 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 / 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 / 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

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 / gist:65ff9fa41ee1631769f5ea89c7c854c8
Last active September 22, 2021 03:54
R Graphics on the terminal with Kitty

base set up:

options(device = function(...) bitmap(file = "|kitty +kitten icat --stdin yes", ...))

with options (eg. anti-aliasing)

options(device = function(...) bitmap(file = "|kitty +kitten icat --stdin yes", taa = 2, gaa = 2, ...))
@andreabedini
andreabedini / git
Created August 3, 2022 14:38
git wrapper to make cabal and hls cache git checkouts more efficiently
#!/usr/bin/env bash
# only subvert cabal
PARENT_COMMAND=$(ps -o comm= $PPID)
if [ "$PARENT_COMMAND" != "cabal" ]; then
exec /usr/bin/git "$@"
fi
echo "$PWD /usr/bin/git $*" >> ~/git-log