Skip to content

Instantly share code, notes, and snippets.

@sglyon
sglyon / Purchase.sol
Created November 14, 2022 18:51
Purchase.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22;
/**
* @title Purchase
* @dev Contract to facilitate purchase/sale of high value art
*/
contract Purchase {
uint256 public price;
@sglyon
sglyon / package.json
Created October 31, 2022 17:26
extra dough package.json
{
"name": "extradough_eater",
"version": "1.0.3",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest",
@sglyon
sglyon / GrowthProject.toml
Created July 8, 2019 12:53
CLMM 2019 resources
[deps]
BasisMatrices = "08854c51-b66b-5062-a90d-8e7ae4547a49"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
QuantEcon = "fcd29c91-0bd7-5a09-975d-7ac3f643a60c"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@sglyon
sglyon / extract_attachments.py
Created February 19, 2018 15:07
nbconvert preprocessor to extract attachments
""" A preprocessor that extracts all of the attachments from the notebook file.
The extracted attachments are returned in the 'resources' dictionary.
Based on the ExtractOutputsProcessor in nbconvert... the license for
nbconvert is
# Licensing terms
This project is licensed under the terms of the Modified BSD License
(also known as New or Revised or 3-Clause BSD), as follows:
@sglyon
sglyon / eigen_xtensor_buf.cpp
Last active October 24, 2023 15:11
xtensor buffer adaptor for eigen VectorXd and MatrixXd
#include <stdexcept>
#include "xtensor/xarray.hpp"
#include "xtensor/xio.hpp"
#include "xtensor/xbuffer_adaptor.hpp"
#include "Eigen/Dense"
auto to_xarray(Eigen::VectorXd& in) {
using buf = xt::xbuffer_adaptor<double>;
using xbuf_arr = xt::xarray_container<buf, xt::layout_type::column_major, std::vector<std::size_t>>;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sglyon
sglyon / get_irs_migration_data.go
Last active May 12, 2017 18:00
async file downloads
package main
import (
"fmt"
"github.com/mitchellh/go-homedir"
"io"
"net/http"
"os"
"path"
"sync"
@sglyon
sglyon / README.md
Last active May 10, 2017 19:04
python imports

Run with python other_file.py

@sglyon
sglyon / example.jl
Last active May 15, 2021 18:55
PlotlyJS.jl slider example
using PlotlyJS
# set up data
na = 10
nw = 5
zz = rand(1:4, na, nw, nw)
text = similar(zz, String)
text[zz .== 1] = "stay, work"
text[zz .== 2] = "move, work"
@sglyon
sglyon / showtime.jl
Created April 5, 2017 17:13
showtime macros
macro showtime(ex)
blk = Expr(:block)
push!(blk.args, :(println($(sprint(Base.show_unquoted,ex)*" = "),
repr(begin value=$(esc(ex)) end))))
push!(blk.args, :value)
quote
local stats = Base.gc_num()
local elapsedtime = Base.time_ns()