Skip to content

Instantly share code, notes, and snippets.

tangentstorm tangentstorm

Block or report user

Report or block tangentstorm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Twinklebear
Twinklebear / fragment.glsl
Last active Aug 29, 2015
Instanced textured quads, produces this render: https://i.imgur.com/opgHu0x.png
View fragment.glsl
#version 330 core
//Sampler defaults to unit 0 which is where our texture is bound
uniform sampler2D tex;
in vec2 fuv;
out vec4 color;
void main(void){
View gist:ae95fbecb0ef0fc7f0ec
NB. parpool.ijs
NB. Attempt to make a J parpool
NB. ----------------------------
NB. Todo's:
NB. - Spin up tasks
NB. - Use net/clientserver's jsss/jssc for workers resp master
NB. - Figure out how to automatically find data from sentence and send to each worker if needed
NB. - keep old data? or discard after return?
NB. - exploit rank (IRS) write parfor / blockprocessing
NB. ...
@adrian17
adrian17 / sudoku.ijs
Created Mar 5, 2015
sudoku in J (translation of APL algorithm)
View sudoku.ijs
s44 =: 4 4 $ 0 0 0 0 0 0 2 1 3 0 0 4 0 0 0 0
box =: (] #"1 ] # ([: i. 2 # ]))
indices =: 3 : 0
yy =. {. y
a =. yy #"0 i. yy
b =. |: a
c =. a ,/"0 b
)
@adrian17
adrian17 / collatz.ijs
Last active Aug 29, 2015
collatz fractal in J
View collatz.ijs
load 'viewmat'
gen_table =: 4 : '(0j1*(i: x)) +/ i: y'
fractal =: 1 : 0
:
x u"0 (y +~ 30000 %~ 150 gen_table 150) NB. resolution and scale, not sure how to decouple them
)
collatz =: 4 %~ 2 + (7*]) - (2+5*])* 2 o. o.
is_bounded_c =: 4 : '((0: collatz^:x) :: 1:) y' NB. collatz
@adrian17
adrian17 / whence.ijs
Last active Aug 29, 2015
whence for J
View whence.ijs
whence =: verb define
select. 4!:0 < y
case. _2 do. 'invalid name'
case. _1 do. 'name not defined'
case. 0;1;2;3 do.
index =. 4!:4 < y
select. * >: index
case. 0 do. 'name defined locally'
case. 1 do. > index { 4!:3''
end.
@ik5
ik5 / dynamic_method.pas
Created Jun 18, 2012
How dynamically execute a method in Object Pascal Class
View dynamic_method.pas
{$mode objfpc}{$M+}
program test;
type
TMyClass = class
procedure SayHi;
end;
procedure TMyClass.SayHi;
begin
@tangentstorm
tangentstorm / likstromsnat.hs
Last active Oct 9, 2015
a little electronics problem
View likstromsnat.hs
{-
| a dumb little circuit simulator in haskell
| by tangentstorm, 2012/08/22
|
| This basically just calculates values using Ohm's law.
| it (probably?) only works for simple circuits where there
| is a single path from the power source to each node, and
| from each node back to the power source.
|
| many thanks to quicksilver and Axman6 on #haskell for advice
@tangentstorm
tangentstorm / FORLOOP.rx
Last active Dec 11, 2015
Talk about "build one to throw away"
View FORLOOP.rx
## OBERON SYNTAX TO COMPILE:
FOR x := start TO goal BY step DO
block
END;
## StringTemplate ( generating retro code ):
for_stmt(id, beg, end, step, block) ::= <<
( FOR ) <id>
@tangentstorm
tangentstorm / objpas-lexer.txt
Created Feb 27, 2013
Lexer DFA for object pascal
View objpas-lexer.txt
[[a[nd
|rray
|s
|sm]
|b[egin]
|c[ase
|lass
|onst[
|ructor]]
|d[e[structor
@alexaltair
alexaltair / Today's Learning.md
Last active Dec 18, 2015
An exploration of infinite lists.
View Today's Learning.md

The first thing that really surprised me today was the flexibility of Ruby's shovel operator, <<. A student in the class had tried the following:

a = [0]
a << a

What do you think a is now? I was sure it would be [0, [0]]. But lo and behold, Ruby sparkles;

a = [0]
a << a
You can’t perform that action at this time.