Skip to content

Instantly share code, notes, and snippets.

View danielweiv's full-sized avatar

Daniel Wei danielweiv

View GitHub Profile
@danielweiv
danielweiv / serve.go
Created May 17, 2024 20:37 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@danielweiv
danielweiv / GradleCheatsheet.md
Created April 14, 2024 10:00 — forked from jiffle/GradleCheatsheet.md
Cheatsheet of Gradle Commands and Config

Command Cheatsheet

  • Convert Maven build to gradle

    gradle init

  • Initialise new project folder structure (Java example)

    gradle init --type java-library

Go to onedrive folder in your pc and create a folder for git repository.
Usually onedrive resides in `C:\Users\%username%\OneDrive`
Open GitBash
cd ~/OneDrive
mkdir git
cd git
mkdir myproject
cd myproject
@danielweiv
danielweiv / init_postgres_windows.md
Created April 8, 2024 04:23 — forked from jctosta/init_postgres_windows.md
A simple guide on initializing the Windows version of Postgres using the zip file instead of msi installer
@danielweiv
danielweiv / sqlite.py
Created February 22, 2024 13:00 — forked from michalc/sqlite.py
Use libsqlite3 directly from Python with ctypes: without using the built-in sqlite3 Python package, and without compiling anything
# From https://stackoverflow.com/a/68876046/1319998, which is itself inspired by https://stackoverflow.com/a/68814418/1319998
from contextlib import contextmanager
from collections import namedtuple
from ctypes import cdll, byref, string_at, c_char_p, c_int, c_double, c_int64, c_void_p
from ctypes.util import find_library
from sys import platform
def query(db_file, sql, params=()):
@danielweiv
danielweiv / dash-doggybag.py
Created July 7, 2023 17:09 — forked from lucasg/dash-doggybag.py
Bulk downloader for dash docsets (official and user contributed)
#!/usr/bin/env python3
import sys
import json
import os
import os.path
import shutil
import logging
import tempfile
import glob
import argparse
@danielweiv
danielweiv / _readme.md
Created June 17, 2023 18:02 — forked from steeve/_readme.md
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@danielweiv
danielweiv / LLMs.md
Created February 14, 2023 22:17 — forked from yoavg/LLMs.md

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

@danielweiv
danielweiv / ecb.go
Created February 12, 2023 05:10 — forked from DeanThompson/ecb.go
Golang AES ecb mode
package utils
import "crypto/cipher"
type ecb struct {
b cipher.Block
blockSize int
}
func newECB(b cipher.Block) *ecb {