Skip to content

Instantly share code, notes, and snippets.

@AshyIsMe
AshyIsMe / idealcomputing.md
Last active February 17, 2024 05:38
ideal computing environment

What kind of Computing environment do I want?

Dataframe Oriented Programming: https://csvbase.com/blog/1

Accessing up to date data quickly and easily (even on phone) and pulling decision making information out of it constantly should be effortless.

Something like the stories of the old APL mainframe environment.

@AshyIsMe
AshyIsMe / forks_hooks_exploration.ijs
Created December 3, 2022 21:37
forks and hooks in j
NB. What the hell is a fork, a hook and cap?
NB. a is a simple array
a =: 1 2 3 4 5 6 7 8 9 10
NB. What is the average of a?
NB. sum divided-by count
(+/ a) % (# a)
5.5
@AshyIsMe
AshyIsMe / peach.ijs
Last active November 15, 2022 07:41
Parallel Each in j
NB. parallel each: peach
NB. https://code.jsoftware.com/wiki/NYCJUG/2022-11-08#Work_with_Multi-threading
echo 'Must be at least running J904'
echo JLIB
nproc =: {{ {. 8 T. '' }}
createThreads=: 3 : '{{ 0 T. '''' }} ^:({. 8 T. '''')]'''''
@AshyIsMe
AshyIsMe / wttr.py
Created January 26, 2022 03:05
Single line of weather from wttr.in
#!/usr/bin/env python3
from urllib.parse import quote
import subprocess
def wttr(location):
c = "curl wttr.in/" + quote(location) + '?0TQ'
r = subprocess.run(c, shell=True, stdout=subprocess.PIPE)
l = r.stdout.decode('utf-8').split('\n')
@AshyIsMe
AshyIsMe / fauxparquet.ijs
Created January 22, 2022 01:01
Simple SQL style filtering in J
NB. `select a,b,c,d where a=5 and b>7 order by c desc limit 10`
NB. TODO: read data from parquet with https://github.com/AshyIsMe/JArrow
NB. Something like: 'a b c d'=: 'a';'b';'c';'d' readParquet 'foo.parquet'
a=:?1e6$10 NB. 1e6 random ints 0to9 inclusive
b=:?1e6$10
@AshyIsMe
AshyIsMe / hashes.ijs
Created September 12, 2021 06:09
md5 hashing in j
0 : 0
Can you crack Aaron’s password hash? He seems to like
simple passwords. I’m sure he’ll use his name and birthday | in it. Hint: Aaron writes important dates as YYYYMMDD
rather than YYYY-MM-DD or any other special character | separator. Hash: 7f4986da7d7b52fa81f98278e6ec9dcb.
Author: moat, Pacific Northwest National Laboratory
)
y=:":"0 (1900 + i.120)
m=:(i.11) { ('0' ,"1 ":"0 (1+i.9)) , ('1' ,"1 ":"0 (1+i.9))
d=:('0' ,"1 ":"0 (1+i.9)) , (":"0) 10+i.22
@AshyIsMe
AshyIsMe / janimate.ijs
Created May 8, 2021 04:06
processing style playing with j
NB. jgl2 animation demo for j
NB. Based on https://code.jsoftware.com/wiki/Guides/Window_Driver/Animation/Animated_JGL2
NB. by (c) 2019 by michal j wallace http://tangentstorm.com/
NB. free for use under the MIT license. https://opensource.org/licenses/MIT
load 'gl2'
coinsert 'jgl2'
close_handler =: 3 : 0
@AshyIsMe
AshyIsMe / gcc-env.nix
Created April 30, 2021 02:34
gcc9 in nix-shell
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.gcc9
pkgs.gmp
pkgs.primesieve
];
}
NB. http://oeis.org/A342260
a =: verb : '0 } I. y = +/"1 (y-1) = y #.inv ^&2 (i.y^(y+1))' "0
a 2
3
a 3
31
a 4
217
a 5
@AshyIsMe
AshyIsMe / janimation1.ijs
Created April 10, 2021 00:31
Animation in J
NB. Code from the "Basic Animation In J" video
NB. https://www.youtube.com/watch?v=uL-70fMTVnw
NB. ---------------------------------------------------------
NB. animation demo
load 'viewmat'
coinsert'jgl2'
wd 'pc w0 closeok' NB. parent control (window) named 'w0'