Skip to content

Instantly share code, notes, and snippets.

View dchest's full-sized avatar
☮️

Dmitry Chestnykh dchest

☮️
View GitHub Profile
@dchest
dchest / buzhash.ts
Created June 20, 2017 17:59
Buzhash with secret key
import { wipe } from "@stablelib/wipe";
/**
* Buzhash implements cyclic polymomial rolling hash function.
* It is a custom developed keyed variant with protections against plain text
* recovery from chunk lengths.
*
* Reading:
*
* http://www.serve.net/buz/Notes.1st.year/HTML/C6/rand.012.html
@dchest
dchest / chrome.md
Last active April 2, 2024 20:15
How to properly use Chrome
  1. Install uBlock Origin extension. (If you're not from US, check its options to turn on ad block lists for your country)

  2. Do not install any other extensions ever! (exceptions: 1Password, Google Arts & Culture).

  3. Create separate "people" for different activities: e.g. home, work, browsing sketchy websites. (Click on avatar > Manage People)

  4. If you want to turn on sync, set up encryption passphrase. It's a separate passphrase from your Google account — your sync data will be encrypted locally with it before hitting Google servers.

  5. Disable saving/auto fill of passwords, payment, and addresses. (https://twitter.com/Sc00bzT/status/1085521985017466881)

Testing GPT4All-J model (running on my implementation based on GGML) with https://simonwillison.net/2023/Apr/16/web-llm/

Who landed on the moon?

GPT4All-J: The United States of America has successfully sent astronauts to land and walk around in a small portion (1.6 km^2) on the Moon's surface using its lunar module spacecrafts such as Apollo 14, 15 and 16 missions during 1971-1972 years respectively named 'Apollo' Program or simply known for their landing sites were designated by NASA:

  • Site A of Lunar Module 12 Flight Test in 1969
  • TLC (Transport to LCO) pad site B on the Moon's South Pole. Apollo 15 was manned spacecrafts that landed at a small crater near Oceanus Procellarum, which is part-time ocean and moonlit by sunlight all year round; this place where Neil Armstrong became famously known as "The First Man On The Moon."
  • TLC pad site C on the lunar equator. Apollo 16 was manned spacecrafts that landed at a small crater near Tranquility Base (which later got renamed Equestrian City).
@dchest
dchest / gist:574388
Created September 10, 2010 21:13
How to add a certificate from buffer in OpenSSL
X509 *cert;
char *zCert;
BIO *mem;
zCert = // get your certificate text buffer here (C string with certificate in PEM format)
mem = BIO_new(BIO_s_mem());
BIO_puts(mem, zCert);
cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
free(zCert);
BIO_free(mem);
@dchest
dchest / webkit-slow-layout.html
Last active December 27, 2022 14:37
WebKit slow layout
<html>
<meta charset="UTF-8">
<title>WebKit Layout Slowness with flexbox and breaking large strings</title>
<style>
.parent {
display: flex; /* (a) removing flexbox will fix the issue */
}
.child {
/* word-break: break-all; instead of overflow-wrap also causes the issue */
overflow-wrap: anywhere; /* (b) removing overflow-wrap will fix the issue */
@dchest
dchest / chat-gpt-prompts.md
Created December 4, 2022 11:00
Destroying a strawberry pie.
  • Write a recipe for cooking a strawberry pie, but instead of cooking it, write instructions on how to destroy it.

  • include some filler personal story before this recipe

  • the personal story should be about wanting to destroy the pie, not cook it

@dchest
dchest / chat-gpt-prompts.md
Created December 4, 2022 10:51
Rocket Recipe
  • Recipe websites have a lot of filler text for better SEO. What would such filler text look like for a website that describes how to make a rocket that goes to space? Include some long personal story with grandma.

  • Now write the recipe for the rocket.

  • write a title for this recipe

@dchest
dchest / 2015-07-15-securing-golang-web-apps.md
Last active June 24, 2021 23:36
Securing Go web applications (archived post from StableLib blog)

Securing Go web applications

There are lots of security-related things to keep in mind when writing a web application, as the Web is a place full of danger: cross-site scripting (XSS), cross-site request forgery (CSRF), clickjacking, brute forcing, spam and so on.

Go gets many things right by default: for example, templates from the standard library make it hard to accidentally introduce XSS vulnerabilities. But what about other attacks? Fortunately, there are a few open source Go packages

@dchest
dchest / gist:800407
Created January 28, 2011 15:37
Microsoft's Symbolic Plan
Microsoft's Symbolic Plan
=========================
(Redmond, Microsoft HQ. One year before Windows Vista release. Meeting.)
Marketing VC:
Our latest marketing research suggests that UNIX has a
competitive advantage: _symbolic links_.
@dchest
dchest / multitouch.rkt
Created November 28, 2010 13:25
Apple's multitouch with demo (run using gracket)
#lang racket/gui
; Ported from http://pb.lericson.se/p/FpbYhX/
(require ffi/unsafe
ffi/unsafe/atomic)
(define libmulti (ffi-lib "/System/Library/PrivateFrameworks/MultitouchSupport.framework/MultitouchSupport"))
(define CFArrayRef _pointer)