Skip to content

Instantly share code, notes, and snippets.

View stnbu's full-sized avatar
💫
detecting the ether

Mike Burr stnbu

💫
detecting the ether
View GitHub Profile
use std::f32::consts::TAU;
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
fn main() {
let mut app = App::new();
#[cfg(target_arch = "wasm32")]
app.add_system(handle_browser_resize);
@stnbu
stnbu / fast-bevy-build.diff
Last active September 28, 2022 14:16
Fast Bevy Dev Build -- all tweaks
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..f51f913
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,2 @@
+[target.x86_64-apple-darwin]
+rustflags = ["-C", "link-arg=-fuse-ld=/Users/mburr/bin/zld"]
diff --git a/Cargo.toml b/Cargo.toml
index 0d54bf7..50c2f97 100644
@stnbu
stnbu / wow_neat.rs
Created August 29, 2022 18:45
A decent result after thinking about primes forever and not looking at the book
struct Sieve<'a> {
primes: &'a mut Vec<u32>,
}
impl<'a> Sieve<'a> {
pub fn new(primes: &'a mut Vec<u32>) -> Self {
Sieve { primes }
}
}
@stnbu
stnbu / custom_except_handler.php
Last active December 5, 2018 19:28
I'm gonna blame Microsoft
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
@stnbu
stnbu / db.py
Created September 3, 2018 23:09
Using the Django ORM outside of the web framework
# I was able to just put this module alongside `models.py` and use `myapp.db.FooTable(**kwargs).save()` etc outside
# of the web framework. With no issues, so far.
import django
from .settings import *
from django.conf import settings
settings.configure(DATABASES=DATABASES)
django.setup()
@stnbu
stnbu / qp.dev-net
Last active May 11, 2018 18:52
hacky script to bootstrap test nodes for parity test net
#!/bin/sh
# hacky but useable script for quick/easy parity test node deployment. Requires commands "parity" and "tmux"
# Set these as required:
BASE_PATH=~/meth/nodes
BIND_IP=10.45.92.1
LOG_LEVEL=info
@stnbu
stnbu / emacs_rename_file_korectly.txt
Created May 10, 2018 19:48
So all the right things magically happen, rename files instead of doing klunky things involving killing buffers...
;; from http://ergoemacs.org/emacs/rename_file_pattern.html
To rename multiple files in emacs, the most easy way is:
Alt+x dired to go to the directory.
Alt+x dired-toggle-read-only 【Ctrl+x Ctrl+q】.
Then, just edit the file names.
When done, wdired-finish-edit 【Ctrl+c Ctrl+c】 to commit the changes.
To abort, Alt+x wdired-abort-changes 【Ctrl+c Ctrl+k】.
#!/bin/sh
# https://wiki.parity.io/Private-development-chain
# https://github.com/paritytech/parity/issues/7470
# 0x00a329c0648769a73afac7f9381e08fb43dbea72
BASE_PATH=~/meth/nodes
BIND_IP=10.45.92.1
LOG_LEVEL=info
@stnbu
stnbu / .emacs
Created May 6, 2018 18:58
when meta key doesn't work on remote (ssh) linux host (sometimes)
(set-input-mode t nil t)
import os
s = os.statvfs('/')
use = 1 - float(s.f_bavail) / float(s.f_blocks)