This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
crand "crypto/rand" | |
"github.com/smallnest/ringbuffer" | |
"log" | |
"math/rand" | |
"sync" | |
"time" | |
) | |
func generateRandomBytes() []byte { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"notes": "", | |
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", | |
"keyboard": "ferris/sweep", | |
"keymap": "ferris_sweep_ferris_sweep_hmod", | |
"layout": "LAYOUT_split_3x5_2", | |
"layers": [ | |
[ | |
"KC_Q", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! tw { | |
// Base case: when there are no tokens left, return an empty string. | |
() => (String::new()); | |
// New case: handle static string literals | |
($static:literal ; $($rest:tt)*) => {{ | |
let mut class = String::from($static); | |
let rest_classes = tw!($($rest)*); | |
if !rest_classes.is_empty() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::Future; | |
use std::sync::Arc; | |
use tokio::sync::Notify; | |
use tokio::sync::Semaphore; | |
use tokio::task::spawn; | |
use tokio::time::{interval, Duration}; | |
#[derive(Clone)] | |
pub struct Limiter { | |
capacity: usize, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use js_sys::{Array, Object, Reflect}; | |
use leptos::html::Div; | |
use leptos::*; | |
use wasm_bindgen::prelude::*; | |
use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement}; | |
// Step 1: Create the WaveSurfer Binding | |
#[wasm_bindgen] | |
extern "C" { | |
pub type WaveSurfer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use validator::{Validate, ValidationErrors}; | |
macro_rules! form_field_vec_methods { | |
($field_name:ident, $field_type:ty) => { | |
paste::item! { | |
pub fn [<err_ $field_name>](&self) -> Option<String> { | |
self.0.get().is_valid(stringify!($field_name)) | |
} | |
} | |
paste::item! { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of svg -> b64 | |
function svgTob64(svg_str) { | |
return "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svg_str))); | |
} | |
const get_image = b64 => | |
new Promise((res, rej) => { | |
var img = new Image(); | |
img.addEventListener("load", () => res(img)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I set up my mesh and insert my custom attribute with an empty value | |
pub const ATTRIBUTE_FRAME: MeshVertexAttribute = | |
MeshVertexAttribute::new("frame", 988540917, VertexFormat::Float32x2); | |
let mut mesh = Mesh::from(shape::Quad::new(Vec2::splat(48.0))); | |
let empty: Vec<[f32; 2]> = vec![[0.0; 2]; 4]; | |
mesh.insert_attribute(ATTRIBUTE_FRAME, empty); | |
// Add attribute with batched values in batch loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
COMMAND="build" | |
USAGE=" | |
Usage: bundle application [-w] [-h] \n\n | |
-w watch for file changes and rebuild the bundle \n | |
-h help \n | |
" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=$';' | |
for i in {3,5,9,17,33,65,129} | |
do | |
query=$(sqlite3 "/Users/jackboyce/Library/Application Support/Ableton/Live Database/Live-files-32.db" "SELECT _rowid_,* FROM main.files WHERE colors = $i") | |
copyFile () { | |
while read data; do |