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
| package main | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "crypto/rand" | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "os" |
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
| package main | |
| # This decrypts a file that was encrypted with encryptor where the file name was appended with .enc | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "fmt" | |
| "io/ioutil" | |
| "os" |
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
| <?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 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
| extends Node2D | |
| func _ready(): | |
| yield(VisualServer, "frame_post_draw") | |
| var img = $ViewportContainer/Viewport.get_texture().get_data() | |
| img.flip_y() | |
| img.save_png("vp_image.png") | |
| img = $VP3D/Viewport.get_texture().get_data() |
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
| func _input(_event): | |
| if Input.is_action_just_pressed("ui_cancel"): | |
| get_tree().quit() |
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
| # Add to main autoload file | |
| func _ready(): | |
| # Check the last child node of the root | |
| var scene_node = get_node("/root").get_children()[-1] | |
| if scene_node.filename != ProjectSettings.get_setting("application/run/main_scene"): | |
| var property = "position" | |
| if scene_node is Control: | |
| property = "rect_" + property | |
| set(property, get_viewport().size / 2) |
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
| func array_to_string(a: Array) -> String: | |
| return PoolStringArray(a).join("\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
| var num_bits_index = 0 | |
| var bit_lengths = [4, 8, 16] | |
| func int2binary(x: int) -> String: | |
| var b = "" | |
| for n in bit_lengths[num_bits_index]: | |
| b = String(x % 2) + b | |
| x /= 2 | |
| return b |
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
| extends Node2D | |
| export var nmax = 300 | |
| func _ready(): | |
| # Find prime numbers | |
| sieve_of_eratosthenes(nmax) | |
| func sieve_of_eratosthenes(n: int): |
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
| var keys = {} | |
| func _unhandled_input(event): | |
| if event is InputEventKey: | |
| # Add new key to dictionary | |
| if not keys.has(event.scancode): | |
| keys[event.scancode] = false | |
| # Respond to change in key state (pressed or released) | |
| if event.pressed != keys[event.scancode]: | |
| # Remember the current state |