Skip to content

Instantly share code, notes, and snippets.

View FrankDeGroot's full-sized avatar

Frank de Groot - Schouten FrankDeGroot

View GitHub Profile
@joeddav
joeddav / chatgpt.py
Last active August 5, 2023 14:29
Simple ChatGPT
import openai
class ChatGPT:
""" A very simple wrapper around OpenAI's ChatGPT API. Makes it easy to create custom messages & chat. """
def __init__(self, model="gpt-3.5-turbo", completion_hparams=None):
self.model = model
self.completion_hparams = completion_hparams or {}
self.history = []
self._messages = []
@kesor
kesor / Dockerfile
Last active August 11, 2023 21:17
Compile DENO on Alpine (w/MUSL C)
FROM rust:alpine
RUN apk add --no-cache \
bash \
binutils-gold \
ca-certificates \
clang \
curl \
g++ \
git \
@ryan-williams
ryan-williams / http4s.scala
Created July 2, 2018 02:54
Minimal web servers in scala, supporting a simple GET / HEAD endpoint
import $ivy.`org.http4s::http4s-dsl:0.18.13`
import $ivy.`org.http4s::http4s-blaze-server:0.18.13`
import cats.effect._
import org.http4s._
import org.http4s.dsl.io._
import org.http4s.server.blaze._
val response = "This is the response"
val port = 8000
@genneko
genneko / light-theme.minttyrc
Created June 13, 2018 00:27
Light color theme for mintty
Black=0,0,0
Red=255,100,0
Green=183,234,17
Yellow=234,206,28
Blue=65,105,225
Magenta=237,157,185
Cyan=0,191,191
White=255,255,255
BoldBlack=64,64,64
BoldRed=255,100,0
@ndelangen
ndelangen / child.js
Last active December 5, 2022 18:38
NodeJS child_process communication (IPC) example
if (process.send) {
process.send("Hello");
}
process.on('message', message => {
console.log('message from parent:', message);
});

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@davestevens
davestevens / LetsEncrypt.md
Last active March 28, 2024 10:35
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@tstellanova
tstellanova / start_ssh_agent.sh
Created September 7, 2014 15:54
Start ssh-agent at startup on ubuntu
# typically you'd add this at the end of eg .bashrc
# setup ssh-agent
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob