Skip to content

Instantly share code, notes, and snippets.

View andrew-wilkes's full-sized avatar

Andrew Wilkes andrew-wilkes

View GitHub Profile
@andrew-wilkes
andrew-wilkes / enc.gd
Created February 8, 2019 14:26
Godot simple text file obfuscation
var d = File.new()
if d.file_exists(DIALOG_FILE):
encode_dialog()
d.open(ENC_DIALOG_FILE, File.READ)
dialog = flip_bytes(d.get_buffer(d.get_len())).get_string_from_utf8().split("###")
d.close()
func encode_dialog():
var file = File.new()
file.open(DIALOG_FILE, File.READ)
@andrew-wilkes
andrew-wilkes / obfuscation-test.gd
Created February 9, 2019 07:45
Test code for text obfuscation methods
extends Node2D
func _ready():
var test_bytes = generate_test_bytes()
var processed_bytes = flip_bytes(flip_bytes(test_bytes))
print(compare_bytes(test_bytes, processed_bytes))
func generate_test_bytes() -> PoolByteArray:
var bytes = [] as PoolByteArray
for i in range(256):
@andrew-wilkes
andrew-wilkes / gist:83b80fac1fd9ae21f2da064f7164bdf0
Created February 27, 2019 09:56
GDScript support for prism.js
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+c+csharp+cpp+python+typescript */
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-([\w-]+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e,t){var a=n.util.type(e);switch(t=t||{},a){case"Object":if(t[n.util.objId(e)])return t[n.util.objId(e)];var r={};t[n.util.objId(e)]=r;for(var l in e)e.hasOwnProperty(l)&&(r[l]=n.ut
@andrew-wilkes
andrew-wilkes / gdscript-keywords-stripper.php
Created February 27, 2019 10:01
GDScript Keywords Extractor Script
<?php
$txt = "if See if/else/elif.
elif See if/else/elif.
else See if/else/elif.
for See for.
while See while.
match See match.
break Exits the execution of the current for or while loop.
continue Immediately skips to the next iteration of the for or while loop.
@andrew-wilkes
andrew-wilkes / code.php
Created February 27, 2019 11:27
PHP Code to replace a token with injected content
<?php
class Code
{
private static $langs = array(
"gd" => "gdscript",
"cpp" => "C++"
);
public static function insert($content)
{
@andrew-wilkes
andrew-wilkes / track.scad
Created April 13, 2019 07:55
Straight and curved railway rail track OpenScad code
/* Track */
module track(num_sleepers = 10)
{
SPACING = 8;
RAIL_PITCH = 16.5;
RAIL_LENGTH = num_sleepers * SPACING;
RAIL_SIZE = [RAIL_LENGTH, 0.5, 0.8];
SLEEPER_SIZE = [2, RAIL_PITCH * 1.2, 0.4];
CURVE_ANGLE = 160;
@andrew-wilkes
andrew-wilkes / phonetic-alphabet-memorizer.gd
Last active December 1, 2019 11:39
Phonetic Alphabet Memorizer
extends CenterContainer
const words = "ALFA, BRAVO, CHARLIE, DELTA, ECHO, FOXTROT, GOLF, HOTEL, INDIA, JULIETT, KILO, LIMA, MIKE, NOVEMBER, OSCAR, PAPA, QUEBEC, ROMEO, SIERRA, TANGO, UNIFORM, VICTOR, WHISKEY, X-RAY, YANKEE, ZULU"
const words2 = "Amsterdam, Baltimore, Casablanca, Denmark, Edison, Florida, Gallipoli, Havana, Italia, Jerusalem, Kilogramme, Liverpool, Madagascar, New York, Oslo, Paris, Quebec, Roma, Santiago, Tripoli, Uppsala, Valencia, Washington, Xanthippe, Yokohama, Zurich"
const words3 = "Able, Baker, Charlie, Dog, Easy, Fox, George, How, Item, Jig, King, Love, Mike, Nan, Oboe, Peter, Queen, Roger, Sugar, Tare, Uncle, Victor, William, X-ray, Yoke, Zebra"
const words4 = "Alfa, Bravo, Coca, Delta, Echo, Foxtrot, Gold, Hotel, India, Juliett, Kilo, Lima, Metro, Nectar, Oscar, Papa, Quebec, Romeo, Sierra, Tango, Union, Victor, Whiskey, eXtra, Yankee, Zulu"
var list
var show_letter = true
var i = 0
@andrew-wilkes
andrew-wilkes / Italics.shader
Last active December 10, 2019 18:53
Italic Text Shader for Godot Engine Label
shader_type canvas_item;
void vertex() {
VERTEX.x -= VERTEX.y * 0.3;
}
@andrew-wilkes
andrew-wilkes / js-hit.php
Created January 26, 2020 11:06
Unique Website Visitor Logger
<?php
const TESTING = false;
const FILE_NAME = ".hits";
const DAYS = 10;
const PASSWORD = "YOUR PASSWORD HERE";
$user_agent = strip_tags($_SERVER['HTTP_USER_AGENT']);
$bots = ["bot", "slurp", "spider", "crawler"];
foreach ($bots as $bot) {
if (stripos($user_agent, $bot) !== false) exit();
@andrew-wilkes
andrew-wilkes / side-scroll.gd
Created January 31, 2020 13:36
GDScript side scroll code
extends Node2D
const SPEED = 100
var max_x
var pos = 0
var terrain
var p_bg
var p_layer