Skip to content

Instantly share code, notes, and snippets.

View edwardbeckett's full-sized avatar

Edward J Beckett edwardbeckett

View GitHub Profile
@edwardbeckett
edwardbeckett / pychat.py
Last active April 3, 2023 06:15 — forked from mouredev/chatgpt_api.py
Python ChatGPT API
import os # stash our key in the env
import openai # pip install openai
import typer # pip install "typer[all]"
from rich import print # pip install rich
from rich.table import Table
"""
Reference:
- OpenAI Module: https://github.com/openai/openai-python
- ChatGPT API Docs: https://platform.openai.com/docs/api-reference/chat
@edwardbeckett
edwardbeckett / Induction_for_Travel_Time.md
Last active March 2, 2023 16:46
Induction Hypothesis ChatGPT Prompt for Travel Time from Haifa to TelAviv

Ignore all previous instructions.
Execute as an experience computer scientist.
Prompt: Four cars leave Haifa together and arrive in Tel Aviv after two hours.
Show me the induction hypothesis for how long it would take eight cars.


Keybase proof

I hereby claim:

  • I am edwardbeckett on github.
  • I am edwardjbeckett (https://keybase.io/edwardjbeckett) on keybase.
  • I have a public key ASAXVWG9KztnvJd1MmNrMBp7wuOfl9DX3Loj8QaY3nwClwo

To claim this, I am signing this object:

@edwardbeckett
edwardbeckett / font_letter_check.txt
Created October 24, 2019 09:41 — forked from marcospedreiro/font_letter_check.txt
/u/martinus test pattern to check how distingushable characters are for a font
From: https://www.reddit.com/r/programming/comments/8jjq33/11_best_programming_fonts/dz0xxs5/
------
o0O s5S z2Z !|l1Iij {([|})] .,;: ``''""
a@#* vVuUwW <>;^°=-~ öÖüÜäÄßµ \/\/
the quick brown fox jumps over the lazy dog
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
0123456789 &-+@ for (int i=0; i<j; ++i) { }
@edwardbeckett
edwardbeckett / GitCommitEmoji.md
Created September 19, 2019 17:02 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@edwardbeckett
edwardbeckett / JAXBCollection.java
Created November 22, 2018 00:51 — forked from itavero/JAXBCollection.java
Generic serializer / marshaller / unserializer / unmarshaller class to convert objects into strings and vice versa. Uses the JAXB lib. Personally used this class for converting messages received/sent to a queue (JMS).
/*
* Copyright (c) 2013, Arno Moonen <info@arnom.nl>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@edwardbeckett
edwardbeckett / dualPivotQuicksort.js
Created October 12, 2018 23:46 — forked from lewisje/dualPivotQuicksort.js
Dual-Pivot Quicksort algorithm by Vladimir Yaroslavskiy, now with more input validation and support for (non-astral-plane-safe) string sorting (MIT License): https://web.archive.org/web/20151002230717/http://iaroslavski.narod.ru/quicksort/DualPivotQuicksort.pdf
// https://web.archive.org/web/20141119215047/http://jsperf.com/javascript-quicksort-comparisons
// based on work from Vladimir Yaroslavskiy: https://web.archive.org/web/20151002230717/http://iaroslavski.narod.ru/quicksort/DualPivotQuicksort.pdf
var dualPivotQuicksort = (function (Math, toString, undefined) {
'use strict';
function swap(arr, i, j) {
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
function dualPivotQuicksort(arr, comp, left, right, div) {
@edwardbeckett
edwardbeckett / LogicalOperators.java
Created March 28, 2018 03:40
Logical Operators Cheat Sheet
public class LogicalOperators {
/*
* TRUTH LOGIC
*
* X & Y
* (AND)
*
* AND is Only True IF BOTH OPERANDS ARE TRUE
* ---------------------------------
@edwardbeckett
edwardbeckett / Inline.java
Last active April 11, 2017 14:57
Demo to assert inlining methods...
112 1 3 java.lang.AbstractStringBuilder::newCapacity (39 bytes)
@ 31 java.lang.AbstractStringBuilder::hugeCapacity (28 bytes)
@ 11 java.lang.OutOfMemoryError::<init> (5 bytes) don't inline Throwable constructors
112 2 3 java.lang.String::hashCode (55 bytes)
113 3 3 java.lang.String::equals (81 bytes)
114 4 3 java.lang.Object::<init> (1 bytes)
114 5 3 java.lang.String::indexOf (70 bytes)
@ 66 java.lang.String::indexOfSupplementary (71 bytes) callee is too large
114 9 n 0 java.lang.System::arraycopy (native) (static)
114 7 3 java.lang.Math::min (11 bytes)
USE [Foo]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[jhi_persistent_audit_event](
[event_id] [bigint] IDENTITY(1,1) NOT NULL,