Skip to content

Instantly share code, notes, and snippets.

View rikwatson's full-sized avatar

Rik Watson rikwatson

View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active July 18, 2024 22:37
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@aadennis
aadennis / DenoPostJson.ts
Created October 18, 2020 21:07
Rest-Post JSON via Deno
// Credit for the basics:
// https://github.com/oakserver/oak/blob/main/examples/routingServer.ts
// Setup: Install deno
// Usage: deno run -A ./DenoPost.ts
// Use e.g. Postman to POST the json payload to http://127.0.0.1:8000/book
// Use e.g. any browser to read the json in memory: http://127.0.0.1:8000/book
import {
bold,
cyan,
@cmod
cmod / hugofastsearch.md
Last active July 10, 2024 18:57 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 11, 2024 21:37
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active June 9, 2024 19:08
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@swyxio
swyxio / 1.md
Last active February 8, 2024 22:30
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

# run git config --global core.excludesfile ~/.gitignore_global
.DS_Store
._.DS_Store
**/.DS_Store
**/._.DS_Store
.vscode
.idea
Thumbs.db
@rikwatson
rikwatson / .editorconfig
Last active October 30, 2018 10:26
An .editorconfig file
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@rikwatson
rikwatson / index.js
Created August 30, 2018 14:40
Using a separate object to handle state in React
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const actions = {
init() {
return { value: 0 };
},
increment(state) {
@rcarmo
rcarmo / ssdp.py
Last active September 24, 2018 12:49
Quick and dirty SSDP/UPNP/Mediaroom discovery
from http.client import HTTPResponse
from io import BytesIO
from config import log
from struct import pack
from socket import AF_INET, SOCK_DGRAM, INADDR_ANY, IPPROTO_IP, IPPROTO_UDP, IP_ADD_MEMBERSHIP, IP_MULTICAST_TTL, SOL_SOCKET, SO_REUSEADDR, SO_REUSEPORT, getaddrinfo, socket, setdefaulttimeout, inet_pton, timeout as SocketTimeout
from utils import etree_to_dict
from xml.etree import ElementTree
from time import time
from dateutil.parser import parse as parse_date