Skip to content

Instantly share code, notes, and snippets.

View zampino's full-sized avatar

Andrea Amantini zampino

View GitHub Profile
@zampino
zampino / latex.ipynb
Last active August 20, 2020 08:12 — forked from fomightez/a_note_on LATEX notebook.md
Latex Example Use in a Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zampino
zampino / test.ipynb
Last active August 19, 2020 16:20
Test Rendering LaTeX in Jupyter Notebook Format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zampino
zampino / deps.edn
Created October 11, 2019 08:57
Global deps edn (~/.clojure/deps.edn)
;; The deps.edn file describes the information needed to build a classpath.
;;
;; When using the `clojure` or `clj` script, there are several deps.edn files
;; that are combined:
;; - install-level
;; - user level (this file)
;; - project level (current directory when invoked)
;;
;; For all attributes other than :paths, these config files are merged left to right.
;; Only the last :paths is kept and others are dropped.
@zampino
zampino / jupyter.sh
Created April 20, 2018 08:56
Jupyter Guide
jupyer kernelspec list
@zampino
zampino / genstage_playground.ex
Created May 11, 2017 09:57
emitter / compressor example
defmodule GenstagePlayground do
defmodule Emitter do
use GenStage
require Logger
defstruct [counter: 0, demand: 0, buffer: []]
def add(), do: GenStage.call(__MODULE__, :in)
def start_link(), do: GenStage.start_link(__MODULE__, :ok, name: __MODULE__)
def init(:ok) do
@zampino
zampino / h5py.py
Created December 4, 2016 21:32
julia context eval + hfs5
pip install h5py
Collecting h5py
Downloading h5py-2.6.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.5MB)
100% |████████████████████████████████| 4.5MB 152kB/s
Collecting numpy>=1.6.1 (from h5py)
Downloading numpy-1.11.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
100% |████████████████████████████████| 3.9MB 176kB/s
Collecting six (from h5py)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, h5py
@zampino
zampino / genstage_subs.ex
Last active November 4, 2016 17:57
meetup presentation code
GenStage.async_subscribe(node, to: other)
def enqueued_resources_for(klass, resource_type: nil)
jobs = enqueued_jobs.find_all { |_job| _job[:job] == klass }
resources = jobs.map {|job|
gid = job[:args].first['_aj_globalid']
gid && GlobalID::Locator.locate(gid)
}
if resource_type
resources = resources.find_all { |resource| resource.is_a?(resource_type) }
end
@zampino
zampino / deps.coffee
Last active August 29, 2015 14:16
dependencies
class Manager
@injects 'Task', 'Store', '...'
constructor: ->
$http.get('/tasks').success (data)->
# works for nested resources too
Store.tasks.push new Task(item) for item in data
class Store
constructor: ->
@zampino
zampino / struct_extension.ex
Last active July 20, 2022 00:32
Elixir Extending a Struct
defmodule DSL do
defmacro extend_struct struct_mod, keyword do
quote do
defstruct Keyword.merge(Map.to_list(Map.from_struct(unquote(struct_mod).__struct__)), unquote(keyword))
end
end
end