Skip to content

Instantly share code, notes, and snippets.

@yoavg
yoavg / LLMs.md
Last active October 30, 2024 08:38

Some remarks on Large Language Models

Yoav Goldberg, January 2023

Audience: I assume you heard of chatGPT, maybe played with it a little, and was imressed by it (or tried very hard not to be). And that you also heard that it is "a large language model". And maybe that it "solved natural language understanding". Here is a short personal perspective of my thoughts of this (and similar) models, and where we stand with respect to language understanding.

Intro

Around 2014-2017, right within the rise of neural-network based methods for NLP, I was giving a semi-academic-semi-popsci lecture, revolving around the story that achieving perfect language modeling is equivalent to being as intelligent as a human. Somewhere around the same time I was also asked in an academic panel "what would you do if you were given infinite compute and no need to worry about labour costs" to which I cockily responded "I would train a really huge language model, just to show that it doesn't solve everything!". We

@ks2211
ks2211 / Phoenix esbuild with Tailwind and Fontawesome
Last active July 30, 2024 01:50
Phoenix with esbuild, fortawesome, and tailwindcss
Phoenix esbuild with Tailwind+Fontawesome
@inopinatus
inopinatus / uu58.rb
Last active October 11, 2023 20:21
Convert UUIDs to/from base58
module Uu58
# Convert a string UUID to a base58 string representation.
#
# Output will be padded up to 22 digits if necessary.
#
# Behaviour is undefined if passing something other than a 128-bit
# hex string in network order with optional interstitial hyphens.
def self.uuid_to_base58(uuid, alphabet = SecureRandom::BASE58_ALPHABET)
ary = uuid.delete("-").to_i(16).digits(58).reverse
ary.unshift(0) while ary.length < 22
@rolandus
rolandus / README.md
Last active June 24, 2024 20:17
How to use an Epson Perfection V500 Scanner to Scan Film (Negatives and Positives)

Before Starting

Download and install the driver and software from here: https://epson.com/Support/Scanners/Perfection-Series/Epson-Perfection-V500-Photo/s/SPT_B11B189011

Preparing the Scanner

Make sure the reflective mat is removed from the top lid (slide out toward front of scanner). Now you should see glass on the lid as well as the scanner base.

Carefully remove all visible dust from the glass with a microfiber cloth. If there are smudges or marks on the glass, use regular window cleaner, and be sure to dry it 100%

Load the Negatives into the Scanner

Make sure the negatives are as clean as possible, but be extremely careful not to scratch them or get figerprints on them. I use a clean microfiber cloth to remove large dust particles and hair. You can use puffed air, or soft antistatic brushes as well.

const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
path: 'url.pdf', // Saves pdf to disk.
format: 'A4',
@spencerhunter
spencerhunter / TransferAndEvents.md
Last active June 14, 2023 20:10
Outlines the sequence of events that are triggered for a subset of Dwolla payment flows that are bank-to-bank via ACH

Overview

Use this doc as a reference to map out the sequence of events your app will receive based on Customer type(s) involved in the transfer as well as where the funds are coming from and going to (bank or balance). The following transfer scenarios are covered in this doc:

Transfer scenario 1 - Source: Verified Customer bank Destination: Verified Customer bank.
Transfer scenario 2 - Source: Verified Customer bank Destination: Unverified Customer bank.
Transfer scenario 3 - Source: Unverified Customer bank Destination: Verified Customer bank.

Both success and failure cases will be shown as well as what occurs in the event of a bank transfer failure.

**General recommend

Title

Surgically Refactoring with Suture

Abstract

The next feature means changing legacy code. The estimate just says "PAIN" in red ink. Your hands tremble as you claim the card from the wall.

For all of Ruby's breakthroughs, refactoring is as painful as 2004, when Feathers' book released. It's time we Make Refactors Great Again.

@odewahn
odewahn / error-handling-with-fetch.md
Last active June 9, 2024 14:27
Processing errors with Fetch API

I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.

Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:

fetch("/api/foo")
  .then( response => {
    if (!response.ok) { throw response }
    return response.json()  //we only get here if there is no error
 })
@will
will / postgres_types.rb
Created February 17, 2016 18:31
proper postgres types for rails
# config/initializers/postgres_types.rb
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.tap do |t|
t[:primary_key] = "bigserial primary key"
t[:datetime] = "timestamptz"
t[:timestamp] = "timestamptz"
t[:string] = "text"
end
@progrium
progrium / bash.sh
Created February 17, 2015 14:19
Comparing natural brevity and concise expressiveness between Go and shell/Bash for certain tasks using each tool's "standard" library.
curl -s "$url" | tar -zxC "$dest"