Intro & Protein Folding stuff.
Jupyter and Markdown intro. Calculating binding energy. Introduction to plotting.
How numbers are represented in python & numpy. Rounding error discussion. Floating point error.
/// `FragmentedBytes` is a ring buffer of Bytes, useful to avoid copying | |
/// heap memory when parsing live content over a network | |
/// | |
/// The `offset` in this function is the offset in `bytes` where we expect to | |
/// parse a new element. | |
/// The return value for each parse function is a tuple of: | |
/// `(new offset, parsed value)` | |
/// | |
/// For anyone non-rusty, the `?` operator will propagate `ParseError` values up the | |
/// stack - similar to throwing exceptsions, without the overhead |
#[derive(Default)] | |
struct FragmentedBytes { | |
parts: VecDeque<Bytes>, | |
len: usize, | |
} | |
impl FragmentedBytes { | |
pub fn push_bytes(&mut self, bytes: Bytes) { | |
self.len += bytes.len(); | |
self.parts.push_back(bytes); |
<script lang="ts"> | |
import vertCode from "./vertex.glsl?raw"; | |
import fragCode from "./fragment.glsl?raw"; | |
let canvasGl: HTMLCanvasElement; | |
let canvas2d: HTMLCanvasElement; | |
function hsvToRgb(h: number, s: number, v: number) { | |
let r: number = 0.0, | |
g: number = 0.0, |
package problem413 | |
import scala.util.Random | |
/** | |
* Generates an array of random numbers in the given bounds. | |
*/ | |
def generateArray( | |
seed: Int, | |
size: Int, |
hs.hotkey.bind({"cmd"}, "1", function() | |
hs.application.launchOrFocus("Firefox") | |
end) | |
hs.hotkey.bind({"cmd"}, "2", function() | |
hs.application.launchOrFocus("/usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app") | |
end) | |
hs.hotkey.bind({"cmd"}, "3", function() | |
hs.application.launchOrFocus("Alacritty") | |
end) | |
hs.hotkey.bind({"cmd"}, "4", function() |
(defun eli/lastpass-helm-list-all () | |
(let* ((cmd-out (shell-command-to-string "lpass ls --color=never")) | |
(raw-lines (split-string cmd-out "\n" t))) | |
(mapcar (lambda (line) | |
(string-match "^\\(.*\\)/\\(.*\\) \\[id: \\([0-9]+\\)\\]$" line) | |
(list (match-string 1 line) | |
(match-string 2 line) | |
(match-string 3 line))) | |
raw-lines))) |
Intro & Protein Folding stuff.
Jupyter and Markdown intro. Calculating binding energy. Introduction to plotting.
How numbers are represented in python & numpy. Rounding error discussion. Floating point error.
#include <pthread.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define THREAD_COUNT (4) | |
#define BATCH_SIZE (10000) | |
uint64_t *prime_nums; | |
size_t prime_number_count = 0; |
// Hacky, but quick. | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
uint64_t *prime_nums; | |
size_t prime_number_count = 0; | |
size_t prime_number_size = 1024; |
#!/usr/bin/env python3 | |
import socket | |
s = socket.socket() | |
host = socket.gethostname() | |
port = 14447 | |
s.connect((host, port)) |