Skip to content

Instantly share code, notes, and snippets.

View gitlarryf's full-sized avatar

Larry Frieson gitlarryf

View GitHub Profile
@gitlarryf
gitlarryf / phind.neon
Created December 6, 2023 02:18
Phind-generated Neon code after minimal teaching was fed to it.
#! Neon 1.0
IMPORT acroname
IMPORT base
IMPORT bigint
IMPORT binary
IMPORT cformat
IMPORT cmdline
IMPORT complex
IMPORT console
@gitlarryf
gitlarryf / MAC.h
Created July 30, 2023 05:57
Header file to help ease cross-compiling between MAX (XCode) iOS, and Windows.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// File : MAC.h
// Author : Larry Frieson
// Desc : Basic typedef's and Macro's for OS/X and iOS.
// Date : 05/23/2012
//
// Copyright © 2012 MLinks Technologies. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __MAC_H__
#define __MAC_H__
@gitlarryf
gitlarryf / strings.h
Created July 30, 2023 05:43
STL String template helper class
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// File : strings.h
// Author : Larry Frieson
// Desc : An STL (std::string) utility implementation. Helper classes if you will.
// Date : 06/04/2012
//
// Copyright © 2012 MLinks Technologies. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __STRINGS_H
#define __STRINGS_H
@gitlarryf
gitlarryf / scanpc-orig.neon
Created April 26, 2023 20:58
Routine to Scan the C: drive, and create a database of all the files.
IMPORT io
IMPORT file
IMPORT datetime
VAR Entries: Number := 0
LET dbPath := "c-files.db"
TYPE Entry IS RECORD
path: String
name: String
@gitlarryf
gitlarryf / qsort.neon
Last active October 3, 2022 20:48
Sample Quicksort algorithm in Neon (https://github.com/ghewgill/neon-lang/neon-lang.git)
VAR words := [ "dog", "cat", "hamster", "parrot", "chinchilla", "rat", "turtle", "snake" ]
quickSort(INOUT words, 0, words.size() - 1)
FOREACH w IN words DO
print(w)
END FOREACH
--= cat
--= chinchilla
--= dog
--= hamster
@gitlarryf
gitlarryf / CMakeLists.txt
Created May 4, 2022 01:21
CMakeLists.txt for neon_bcrypt
cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0054 NEW)
project(neon_bcrypt)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY .)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG .)
if (NOT EXISTS crypt_blowfish-1.3/Makefile)
execute_process(
COMMAND cmake -E tar zxf crypt_blowfish-1.3.tar.gz
@gitlarryf
gitlarryf / xml.neon
Created April 11, 2022 19:50
XML Parsing Library WIP
/*
* File: xml
*
* Provides functions for working with Xml files.
*/
IMPORT file
IMPORT math
IMPORT string
EXPORT parse
@gitlarryf
gitlarryf / TimeSpan.neon
Created September 10, 2021 02:44
Given a number of seconds, can be used to break up a chunk of seconds into Years, Months, Weeks, Days, Hours, Minutes, Seconds and Milliseconds.
IMPORT math
-- ToDo: The goal here would be to create a TimeSpan object by passing the number of seconds
-- into a constructor, if possible...
-- VAR ts: TimeSpan := TimeSpan(1440 * 24 * (365 / 6))
VAR ts: TimeSpan := CalcTimeSpan(2600252 - 3600)
print(ts.toString())
TYPE TimeSpan IS RECORD
milliseconds: Number
@gitlarryf
gitlarryf / cnex_shebang
Created July 1, 2021 18:41
Patch files to patch the cnex executable to be used in a shebang Shell script.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 34e2ad8..4b5e688 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -889,6 +889,20 @@ add_test(
NAME hello_exe
COMMAND tmp/hello.exe
)
+if (WIN32)
+ # Windows needs extra goodies to be able to execute shebang files.
@gitlarryf
gitlarryf / module-install.neon
Created August 5, 2020 03:50
Module Manager for Neon-lang
IMPORT file
IMPORT os
IMPORT string
IMPORT sys
IMPORT textio
LET location: String := "https://github.com/ghewgill/neon-module-registry"
FUNCTION showHelp()
textio.writeLine(textio.stderr, "Usage: module-install.neon [options] module\n")