Skip to content

Instantly share code, notes, and snippets.

View JellyWX's full-sized avatar
💙
Idle

Jude Southworth JellyWX

💙
Idle
View GitHub Profile
@JellyWX
JellyWX / matmul.rs
Last active February 7, 2019 14:27
use std::ops::Mul;
use std::fmt::{Display, Formatter, Result as FmtResult};
#[derive(Debug)]
enum MulError {
BadDimensions,
}
struct Matrix {
contents: Vec<f64>,
#include <iostream>
int main() {
while (true) {
std::cout << "Type 2 numbers: ";
long num1, num2;
std::cin >> num1 >> num2;
long out = 0;
@JellyWX
JellyWX / dateparser-api.py
Created January 28, 2019 12:52
Flask dateparser API
from flask import Flask, request, jsonify
import dateparser
app = Flask(__name__)
@app.route('/', methods=['POST'])
def index():
data = request.json
text = data.get('content')
@JellyWX
JellyWX / rand.lmc
Last active December 20, 2018 17:33
start LDA mul_a2
STO mul_r
mul_p LDA rand
SUB mul_s
STO rand
BRZ mul_e
LDA mul_a2
ADD mul_r
STO mul_r
seed INP
STA 99
BRA isquare
isquare LDA 99
STA 98
STA 97
BRA square
square LDA 97
@JellyWX
JellyWX / max.lmc
Last active November 29, 2018 09:23
Max of 3 numbers in Little Man Computer
start INP
BRZ end
STA 98
SUB 99
BRP store
LDA 97
STA 98
BRA start
store LDA 98
@JellyWX
JellyWX / sieve.rs
Created November 14, 2018 14:08
prime sieve in rust (speedy kinda)
fn main() {
const TARGET: usize = 1_000_000_000;
let o = sieve(TARGET, 3, 5);
for i in 0..o.len() {
if !o[i] {
println!("{}", i)
}
@JellyWX
JellyWX / fizzbuzz.rs
Created November 14, 2018 09:27
Fizz Buzz Oops Rust
fn main() {
const TARGET: usize = 40;
let (f, b, o) = fizz_buzz(TARGET, 3, 5);
for i in 0..f.len() {
println!("{:02} {}{}{}", i,
if f[i] { "fizz " } else { " " },
if b[i] { "buzz " } else { " " },
import json
from os import listdir
def add(args):
d = schema.copy()
d['title'] = input('Add a title >> ')
d['body'] = input('Add a body >> ')
other = input('Add another field (name: value) or press enter to skip >> ')
while other != '':
@JellyWX
JellyWX / cube.py
Last active May 29, 2023 09:04
3D cube rendering in Pygame
import pygame
from math import cos, sin, pi
from numpy import matrix
from time import sleep
from random import randint
WHITE = (255, 255, 255)
WIDTH = 500
HEIGHT = 500