Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tobischw
tobischw / index.js
Created June 4, 2022 19:01
Automatically generate commit messages based on diffs using GPT-3
// 1. npm init
// 2. npm install -save openai simple-git
// 3. Grab an API key from OpenAI: https://beta.openai.com/account/api-keys
// 4. Replace FOLDER_TO_CHECK with the root path of your git-enabled project
//
// Eventually the goal of this is to have a command line utility that lets users
// generates the commit message and commit immediately.
const { Configuration, OpenAIApi } = require("openai");
const simpleGit = require('simple-git');
@jerry-git
jerry-git / vax_app.py
Last active September 19, 2022 04:14
Simple modern Python web app
import datetime as dt
import os
import motor
from beanie import Document, Indexed, PydanticObjectId, init_beanie, operators
from fastapi import FastAPI, Response, status
from pydantic import BaseModel
app = FastAPI()
@mjackson
mjackson / redirects-in-react-router-v6.md
Last active November 12, 2023 07:32
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

@aanari
aanari / set-alacritty-default.sh
Created May 29, 2020 17:00
Set Alacritty as Default Terminal Editor (Ubuntu)
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/alacritty 50
sudo update-alternatives --config x-terminal-emulator
@bretton
bretton / lnd-backup-restore-migrate.md
Last active July 27, 2021 04:34
LND Backup, Restore, Migrate
def player_1(start_date=None, miss_output=False, miss_plot=False, sleep=False, sleep_time=1, plot=False, output=True, hold_max=1000, withdraw_max=500, withdraw_min=10):
user_key, day_info, amount, invested, profit, loss, game_active = bitcoin_game(start_date=start_date)
#print(user_key)
prev_predict = day_info[-1]
miss_colors = ['g']
while game_active == False:
#print(day_info[-1])
if day_info[-1] == 2: #equilavent of 100 i.e. good odds
#print('first option')
if invested < 100: #invest 100
@jdrew1303
jdrew1303 / readme.md
Last active April 2, 2024 20:34
Market Order Matching Engine

Introduction

The computer driven markets for instruments like stocks and exchange traded stock options, have transformed finance and the flow of capital. These markets are enabled by order matching engines (and the infrastructure that supports this software). Before computer trading networks and matching engines, stocks where traded on cavernous exchange floors and transaction costs where high. When electronic trading fully matured, floor traders were a fading anachronism and transaction costs had been reduced to pennies a share in many cases. Electronic trading could not exist without advanced network infrastructure, but without the software matching engines no shares would change hands. The computer trading networks, the matching engine software has also created a concentrated nexus of potential failure. Failures in these systems have increased as the frequency and volume on the electronic networks has increased. The position of order matching engines in the trading infrastructure makes these systems o

@sokol815
sokol815 / quickalerts.md
Last active April 10, 2021 11:10
QuickAlerts Extension for Tradingview
@dhruvbaldawa
dhruvbaldawa / pytransitions.py
Created January 27, 2018 19:50
pytransitions example
from transitions import Machine
class Payments(models.Model):
STATES = {
'started': 'Started',
'captured': 'Captured',
'completed': 'Completed',
}
@Aerijo
Aerijo / making_language_grammar.md
Last active March 18, 2024 05:03
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help: