This file contains 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
extends Node2D | |
export var nmax = 300 | |
func _ready(): | |
# Find prime numbers | |
sieve_of_eratosthenes(nmax) | |
func sieve_of_eratosthenes(n: int): |
This file contains 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
func process_lines_pass1(lines): | |
var addr = 0 | |
var line_num = 0 | |
for line in lines: | |
line_num += 1 | |
var label = "" | |
var directive = "" | |
var op_code = -1 | |
var op_token = "" | |
var no_comment_line = remove_comment(line, ";") |
This file contains 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
class_name Audio | |
var player: AudioStreamPlayer | |
var info | |
func _init(audio_player_instance): | |
player = audio_player_instance | |
func load_data(path: String): |
This file contains 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
extends Control | |
# Code to flip between 0 and 1 speed comparisons | |
func _ready(): | |
const MILLION = 1_000_000 | |
var start = Time.get_ticks_msec() | |
var x = 1 | |
for n in MILLION: |
This file contains 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
func _notification(what): | |
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: | |
if not Input.is_key_pressed(KEY_F8): | |
get_tree().quit() |
This file contains 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
shader_type canvas_item; | |
uniform float value: hint_range(0, 100); // % | |
uniform float thickness: hint_range(0, 100) = 30.; // % thickness | |
uniform sampler2D fg: hint_albedo; | |
uniform sampler2D bg: hint_black_albedo; | |
uniform float offset: hint_range(0, 100); // % | |
uniform float smoothing: hint_range(0, 100) = 5.; | |
void fragment() { |
This file contains 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
// https://www.shadertoy.com/view/lslSR7 | |
shader_type canvas_item; | |
vec3 hsv(float h,float s,float v) { | |
return mix(vec3(1.),clamp((abs(fract(h+vec3(3.,2.,1.)/3.)*6.-3.)-1.),0.,1.),s)*v; | |
} | |
float circle(vec2 p, float r) { | |
return smoothstep(0.1, 0.0, abs(length(p)-r)); // try changing the 0.1 to 0.3 | |
} | |
void fragment() { |
This file contains 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
<?php | |
/* | |
This script is placed on a server or computer that remains powered up and is run via a | |
crontab job at regular intervals to ensure that the reverse SSH tunnel that it creates | |
remains active or gets killed according to the text value contained in a file on a remote | |
server that tells it whether to start or kill the process. | |
That file contains "on" or "off" text that is accessible via a URL. | |
On that server, the user should be able to SSH to it and change the command value in the file. |
This file contains 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
extends Control | |
func _on_button_pressed(): | |
var html: String = $Src.text | |
# Find start of table | |
var idx1 = html.find("boardtable") | |
if idx1 > 0: | |
var idx2 = html.find("</table", idx1) | |
if idx2 > 0: | |
var table = html.substr(idx1, idx2 - idx1) |
This file contains 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
// This shader creates a 2D image that may be used as a Equirectangular panorama background | |
// It creates fairly evenly spread stars (blobs) on a black background | |
// Todo: randomly modulate the positions via theta and radius | |
shader_type canvas_item; | |
uniform float samples = 1000.0; | |
void fragment() { | |
// Project from plane onto a sphere | |
float phi = PI * UV.y; |
NewerOlder