Skip to content

Instantly share code, notes, and snippets.

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@GABeech
GABeech / haproxy.cfg
Created August 21, 2014 18:35
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
@odewahn
odewahn / error-handling-with-fetch.md
Last active February 27, 2024 09:56
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
 })
@yoavg
yoavg / LLMs.md
Last active February 17, 2024 18:39

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 January 31, 2024 05:08
Phoenix with esbuild, fortawesome, and tailwindcss
Phoenix esbuild with Tailwind+Fontawesome
@rolandus
rolandus / README.md
Last active January 14, 2024 16:12
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',
@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
@jraines
jraines / rails31init.md
Created May 24, 2011 17:03
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

anonymous
anonymous / gist:1406238
Created November 29, 2011 20:09
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially