We fit a exponential function for
When not taking a fixed offset of
""" | |
Testing on CPython3.13a1+ | |
Requires some recent patches from main. | |
pip install hypercorn | |
Have successfully run the following apps: | |
- fastapi==0.99.0 | |
- Flask | |
""" |
library(tidyverse) | |
library(jsonlite) | |
library(splitstackshape) | |
library(RColorBrewer) | |
# pull daily temperature from https://climatereanalyzer.org/clim/t2_daily/ | |
temp_json <- fromJSON("https://climatereanalyzer.org/clim/t2_daily/json/cfsr_world_t2_day.json") | |
# create dataframe | |
temp <- as.data.frame(temp_json) %>% |
We fit a exponential function for
When not taking a fixed offset of
{-# LANGUAGE TypeSynonymInstances #-} | |
data Dual d = D Float d deriving Show | |
type Float' = Float | |
diff :: (Dual Float' -> Dual Float') -> Float -> Float' | |
diff f x = y' | |
where D y y' = f (D x 1) | |
class VectorSpace v where | |
zero :: v |
# Klein Tools TI250 image tool by Scott Smitelli. Public domain. | |
# Requires at least Python 3.6 (developed and tested on 3.9) | |
# See https://www.scottsmitelli.com/articles/klein-tools-ti250-hidden-worlds | |
import argparse | |
import numpy as np | |
import re | |
import struct | |
from PIL import Image, ImageDraw |
"""Gist to generate spreadsheet (Excel) pixel art from an arbitrary image. | |
Gist by Sadie Louise Bartholomew ('sadielbartholomew'), 05.08.21. | |
Q) Why would I want to do this? | |
A) Exactly. Programming gives us too much power to do silly and pointless | |
things. | |
Requires certain libraries to work: see the `import` list. |
TL/DR Not every type hole is harmful.
[Disclaimer: The following code is typed with scriptum, a type validator for dynamically typed Javascript. It has its roots in Haskell's Hindley-Milner based type system.]
It helps to consider mutations to get a better intuition. Mutations are a side effect and thus harmful. However, if we manage to hedge side effects so that we don't lose track of them, then we can benefit from the flexibility they provide without having to suffer the consequences.
For mutations this merely essentially means ensuring they stay local. Local mutations are fine in most cases. The same applies to type holes.
Let's work through some code to see if this claim holds. Gradual typing is a trade-off. Good coding means to find the most promising trade-offs.
Note: The code links are to CPython 3.8.5, the most recent release when this was written.
I was recently asked about a performance optimization in CPython around using +=
and +
for string objects.
As some people may already know, if you use +=
or +
a string, it can sometimes be just as fast as ''.join
.
The question was to explain when that optimization couldn't be performed.
We will be going through the following example scenarios:
$ cd /tmp
$ rails -v
Rails 6.0.3.2
$ rails new my-app
Using -T -d postgresql from /Users/rileytg/.railsrc # use postgres, dont use tests (usually add rspec). this is a fairly common rails stack.
...
Bundle complete! 14 Gemfile dependencies, 65 gems now installed.
...
curl 'https://dlcdnets.asus.com/pub/ASUS/wireless/USB-BT400/DR_USB_BT400_1201710_Windows.zip' \
-o bt400-driver.zip
Driver & tools for bt400 can be found here
Plug device and do