Skip to content

Instantly share code, notes, and snippets.

View bredfern's full-sized avatar

Brian Redfern bredfern

View GitHub Profile
@vallesmarinerisapp
vallesmarinerisapp / prompt_generator.py
Created November 8, 2023 02:20
cosmictrip.space prompt generator with GPT-4 for generating DALL-E 3 space images
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.base import JobLookupError
from app import write_log
from models import Prompt, Image
import random
from flask import Flask
import openai
import models
from datetime import datetime
import requests
@todbot
todbot / synthio_midi_synth.py
Last active June 23, 2024 08:27
pretty usable MIDI-controlled synth using synthio in CircuitPython
# synthio_midi_synth.py - pretty usable MIDI-controlled synth using synthio in CircuitPython
# 11 May 2023 - @todbot / Tod Kurt
# Uses cheapie PCM5102 DAC on QTPY RP2040
# Video demo: https://www.youtube.com/watch?v=N-PbbWWDE6k
# Features:
# - midi velocity controls attack rate (gentle press = slow, hard press = fast)
# - notes have small random detune on all oscillators to reduce phase stacking
# - adjustable number of detuned oscillators per note 1-5 (midi controller 83)
# - five selectable waveforms: saw, squ, sin, noisy sin, noise (midi controller 82)
# - vibrato depth on mod wheel (midi controller 1)
@yelban
yelban / notes.md
Created August 12, 2021 11:56 — forked from dreness/notes.md
Low Latency HLS test: how low can you go?
@jacobdepriest
jacobdepriest / codespaces-and-jekyll.md
Last active April 16, 2024 08:30
Using GitHub Codespaces to edit a Jekyll Static Site

Using GitHub Codespaces is my new default for editing a static Jekyll site

  1. Navigate to a repo where you have your Jekyll static site (maybe your GitHub pages site)
  2. Launch Codespaces (Code button -> Cloud -> New codespace on current branch)
  3. Once it's launched, run the following in the terminal
gem install bundler jekyll
bundle update
bundle exec jekyll serve
## Will successfully install amdgpu drivers and rocm,
## but pointless as there is no gpu device attached to WSL2 (only CUDA and DirectML is supported, not /dev/kfd or amd gpus)
## ROCM/HIP
sudo apt update
sudo apt dist-upgrade
sudo apt install libnuma-dev
wget -q -O - http://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
@aconanlai
aconanlai / node-nfs.txt
Created June 27, 2019 01:31
node on nearlyfreespeech
Since mopsled didn't renew their domain, this is from their original blogpost which was a useful reference:
https://web.archive.org/web/20180220190550/http://www.mopsled.com/2015/run-nodejs-on-nearlyfreespeechnet/
NearlyFreeSpeech.net (NFSN) is a very inexpensive web host, DNS provider and domain registrar. NFSN added support in 2014 for NodeJS, Django, and tons of other languages through persistent processes. This guide, based on the Django tutorial provided by NFSN, will demonstrate the setup I used for creating a node.js daemon.
NFSN Configuration
If you’re creating a new website, select the Custom domain type:
Choose custom domain option for new site
@CodyReichert
CodyReichert / react-es6-flow-emacs-configuration.md
Last active July 28, 2024 04:47
Configuring Emacs for react, es6, and flow

Configuring Emacs for react, es6, and flow

For a while, JSX and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.

This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.

Set up web-mode

web-mode provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.

@francisrstokes
francisrstokes / StateDispatcher.js
Last active May 28, 2019 02:31
Redux without redux - sharing state and one way data flow using only standard react
import React from 'react';
export class StateDispatcher extends React.Component {
constructor(props) {
super(props);
this.state = props.state || {};
this._dispatch = this.dispatch.bind(this);
}
dispatch(action) {
@myshov
myshov / function_invocation.js
Last active August 19, 2024 12:23
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);