Skip to content

Instantly share code, notes, and snippets.

@sadalsvvd
sadalsvvd / as_context.md
Created March 19, 2023 20:20
CondenseGPT and ExpandGPT - prompts for compressing complex user data for future referenc

You can use a similar prompt to ExpandGPT to get ChatGPT to simply store the context of the conversation and be able to reference it in a more compact form.

Context Addition Prompt

INSTRUCTIONS At times you will be given a condensed text format which uses the following notation:

  1. {Type:TextType} - Specify the type of text (e.g., Narrative, EssayExtract).
  2. {Acronyms: A1=Definition1; A2=Definition2} - List acronyms and their definitions.
  3. {#|EDetail1;Detail2;...} - Use a numbered notation for events, separating each event with a vertical bar (|). Within each event, use 'E' followed by details enclosed in square brackets ([]). Separate details with semicolons (;). Include important details in brackets.
@theycallmemac
theycallmemac / flip.sh
Created July 21, 2019 07:58
A short bash script to simulate a coinflip.
#!/bin/bash
FLIP=$(($(($RANDOM%10))%2))
if [ $FLIP -eq 1 ];then
echo "heads"
else
echo "tails"
fi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@karpathy
karpathy / min-char-rnn.py
Last active November 17, 2024 20:43
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@mef
mef / pre-render.js
Last active May 20, 2022 16:56
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
// pre-render d3 charts at server side
var d3 = require('d3')
, jsdom = require('jsdom')
, fs = require('fs')
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>'
jsdom.env({
features : { QuerySelector : true }
, html : htmlStub
, done : function(errors, window) {
@caged
caged / d3-server.js
Last active October 17, 2023 04:05
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
@jaymcgavren
jaymcgavren / javascript_objects.md
Last active September 12, 2018 09:23
In this screencast, Jay McGavren gives you a clear, no-nonsense look at Javascript objects. You'll learn how properties and functions are woven together to make a complete object. You'll learn what's special about constructor functions (not that much), and how prototypes form the basis for creating new objects. If you're ready to take the next s…

Objects

To create a new object, use the new keyword followed by a call to a constructor function. Javascript provides the Object() constructor out-of-the-box:

var toilet = new Object();

Properties

Once you have an object, you can set and get properties on it, like this:

@mbostock
mbostock / .block
Last active August 5, 2024 16:51 — forked from mbostock/.block
Pie Chart
license: gpl-3.0
redirect: https://beta.observablehq.com/@mbostock/d3-pie-chart