Assuming macOS and an SD card presented as /dev/rdisk3:
For ARMv7 (Pi 2):
diskutil unmountDisk disk3
xzcat ubuntu-18.04.2-preinstalled-server-armhf+raspi2.img.xz | sudo dd of=/dev/rdisk3 bs=32m
# install DSPy: pip install dspy | |
import dspy | |
# Ollam is now compatible with OpenAI APIs | |
# | |
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call. | |
# If you do not include this you will get an error. | |
# | |
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete. | |
# At least with mistral. |
!pip install fastai | |
!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python | |
import cv2 | |
from os import path | |
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag | |
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) | |
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu' | |
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl torchvision |
Guide to setting up a new Ubuntu 18.04 dev environment with Ruby and Elixir installed with the asdf version management tool.
Some of these packages may already be installed
sudo apt-get install make binutils gcc build-essential \
git curl zlib1g-dev openssl libssl-dev libreadline-dev \
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
DELIMITER ;; | |
DROP FUNCTION IF EXISTS shard_nextval;; | |
CREATE FUNCTION shard_nextval() RETURNS BIGINT | |
BEGIN | |
INSERT INTO shard_seq VALUES (NULL); | |
SET @R_ObjectId_val = LAST_INSERT_ID(); | |
DELETE FROM shard_seq; | |
RETURN @R_ObjectId_val; | |
END;; |
import shapeless._ | |
import scalaz._ | |
import Scalaz._ | |
object console extends App { | |
trait Foo[A] { | |
type B | |
def value: B |
A response to http://ayende.com/blog/170849/why-ravendb-isnt-written-in-f-or-the-cost-of-the-esoteric-choice
As you know, I generally recommend using SqlServer for data storage.
But many people have suggested that using RavenDB rather than SqlServer would dramatically reduce the development effort.
My reply to that was that using RavenDB would also lead to a lot more complexity, reduced support by other teams, harder to find DBAs and increased costs all around.
// Simple monad to deal with multiple database transactions with same connection, their commits and rollbacks | |
// Something similar done in http://advorkovyy.blogspot.com.au/2010/10/transactional-monad-for-scala.html | |
import java.sql.Connection | |
trait DbTransaction[A] { | |
def unit: Connection => A | |
def map[B](f: A => B): DbTransaction[B] = DbTransaction { | |
connection => f(unit(connection)) | |
} |