Skip to content

Instantly share code, notes, and snippets.

@aszenz
aszenz / react-app-with-declarative-side-effects.tsx
Created May 27, 2022 15:44
React Declarative side effects (useReducerWithEffects)
import React from "react";
type Reducer<State, Action, Effect> = (
state: State,
action: Action
) => [State, Effect];
type EffectHandler<Effect, Action> = (effect: Effect) => Promise<void | Action>;
type StateWithEffect<State, Effect> = [State, Effect];
{
description = "activity watch";
inputs = {
# for building rust apps
naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
use std::collections::hash_map::HashMap;
/// Cacher can cache function calls of one argument
pub struct Cacher<Computation, Input, Output>
where
Computation: Fn(Input) -> Output,
Input: std::cmp::Eq + std::hash::Hash,
Output: std::clone::Clone,
Input: std::clone::Clone,
{
# Updated/fixed version from Gene Kogan's "machine learning for artists" collection - ml4a.github.io
import time
import os
import re
import random
import argparse
import urllib.request
import itertools
import bs4
from __future__ import print_function
import os
import math
import torch
import argparse
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.legacy.nn as lnn
# ==================================================================
# module list
# ------------------------------------------------------------------
# torch latest (git)
# ==================================================================
APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
#!/usr/bin/env bash
set -e
######################################################################
# This script installs required dependencies for Torch7
######################################################################
{
install_openblas() {
# Get and build OpenBlas (Torch is much better with a decent Blas)
@aszenz
aszenz / eda_credit_dataset.ipynb
Last active October 27, 2018 12:56
EDA_Credit_Dataset.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.