Skip to content

Instantly share code, notes, and snippets.

Avatar
🖖
keep on keeping on

Richard RichardJohnn

🖖
keep on keeping on
  • eFlex Systems
  • Michigan
View GitHub Profile
View chaos.js
//chaos game (https://en.wikipedia.org/wiki/Chaos_game)
//parameters: n = 5, r = 2 & cannot pick same vertex twice
//demo: https://editor.p5js.org/RichardJohnn/sketches/VxFo5o_Yv
//image: https://i.imgur.com/iBFEZDO.png
let w ;
let h ;
let x = 0;
let y = 0;
let anchors = [];
@RichardJohnn
RichardJohnn / use.coffee
Last active Apr 10, 2020
universal sentence encoder - percent similarity
View use.coffee
tf = require('@tensorflow/tfjs-node')
use = require('@tensorflow-models/universal-sentence-encoder')
use.load().then (model) ->
sentences = [
'Hello.'
'Hi.'
'Greetings.'
'Sup?'
"It's nice to meet you."
'How are you?'
@RichardJohnn
RichardJohnn / heapsAlgorithmForPermutationGeneration.rs
Created Sep 25, 2015
Heap's Algorithm for Permutation Generation in Rust
View heapsAlgorithmForPermutationGeneration.rs
//https://en.wikipedia.org/wiki/Heap%27s_algorithm
fn main(){
let mut array = vec![1,2,3,4];
generate(4, &mut array);
}
fn generate(n : usize, a : &mut Vec<usize>) {
if n == 1 {
println!("{:?}", a);
}
@RichardJohnn
RichardJohnn / removeOrigs.sh
Created Jun 25, 2014
auto remove .orig files on os x
View removeOrigs.sh
#brew install fswatch
#replace ~/shit with directory to watch, -r for recursively
fswatch -r0 ~/shit | while read -d "" event
do
regex='\.orig$'
if [[ ${event} =~ $regex && -e ${event} ]]
then
rm ${event}
@RichardJohnn
RichardJohnn / Euler No. 125
Created Feb 22, 2014
J for Project Euler 125.
View Euler No. 125
+/(#~(100000000)&>) (#~(=|.&.":)"0)x:(~.,(2+i.700)(+/@:*:)\>:i.7090)
You can’t perform that action at this time.