Skip to content

Instantly share code, notes, and snippets.

View LeFreq's full-sized avatar
:electron:
Ready for the jump to light speed.

Marxos LeFreq

:electron:
Ready for the jump to light speed.
View GitHub Profile
@LeFreq
LeFreq / Python3000
Last active October 11, 2015 07:58
The real Python 3000
This is a start for an examination of Python and its evolution. More specifically, it looks at the issue of what was called Python3000 (Python3k) and how well the release of Python3 lived up to its hopes and vision. (For more detail see Ward's Wiki at the WikiWikiWeb).
I think many have not migrated over to python3 because there was a feeling of being let down with the possibilities of re-structuring Python for its famed 3000 release. This gist is a place holder for all issues that I know relating to a fully satisfying Python 3000 that keeps to the spirit of the Python community and continues the path of elegance.
Without knowing, Python (and the computer programming domain, in general) has been evolving into a Unified Information Model. In hindsight, this seems a natural trajectory within the field of Computer Science towards simplification of data handling and ease of use. Elegance has become the keyword for programmers in the Programming and Open Source community and I think Python is the language w
@LeFreq
LeFreq / Pick.py
Created November 24, 2012 04:10
Probabilistic Chooser
"""Given a list of items, each with a floating-point number representing popularity, bounded at the bottom at zero (no negative values), pick an item based on the weight of that popularity.
"""
#NOTE: A variant of this is used in the Network flow class in pangaia. <github/Social-Garden>\
#This was originally developed for genetic algorithms and the program called GA-SOLVE written in Pascal in 1992
# Zero-weighted values are given a value equal to *half* the lowest value.
from random import *
cityrank = {"Denver": 0.5, "Chicago": 1.0, "Houston": 0.0, "NYC": 2.9}
@LeFreq
LeFreq / Chooser
Last active October 20, 2019 12:57
Probabilistic Chooser Algorithm
Probabilistic Chooser: idea for giving fair output for all contributing participants based on a weighted vote. Should be used for all websites (for example) which use crowdsourced voting to prevent positive feedback loops.
(R) Registered Mark Janssen, under Creative Commons: BY, NC. Patents pending (hence NC) and these ideas are used in the GA-SOLVE program as well.
In the common Internet context of listing dynamic content that users are voting for, one encounters users gaming the ranking system by seeing who gets first, or unrecognized but good content content hiding below the popular content.
The solution is to give a weighted listing where each item is chosen proportional to its vote. This technique will prevent positive feedback loops that raise popular items forever above the rest (due to limitations of people's attention span to scan all contributions or positions). The idea is for every contribution, tally a count of all votes, then each contribution gets weighted from this total and an intelligen
@LeFreq
LeFreq / BigInts
Last active December 22, 2015 18:59
How to implement arbitrarily-sized integers.
Arbitrary-precision arithmetic (aka BigNums)
(R) Registered Mark Janssen under Creative Commons: BY; idea can be used commercially if attribution is given in the credits and the resulting software if available freely to author or website is available to public.
The right way to think about implementing arbitrarily-sized integers is to use base-256 encoding and using simple ASCII strings (i.e. Ascii-Coded Binary).
To make an arbitrary precision *real* number, use Bigint to make an "Rational" class that simply uses two BigInts as numerator and denominator.
Now you have an exact, lossless way to represent any (finite) "real" number.
@LeFreq
LeFreq / HowToCode
Created March 18, 2015 00:41
How to Code
How to Code, v.20150317 DRAFT
@Xer0Dynamite
== Audience ==
Programmers and coding can be divided into four camps:
1. Participating in the Programmer/Data Ecosystem (GPL and OOPv2),
2. Scientific Computing (Performance-based),
3. Business Use (Persistence and Security of Data),
@LeFreq
LeFreq / anaglyph
Last active August 29, 2015 14:19
Proper 3-d stereo glasses implementation
Implementing proper 3-d with red-blue stereo glasses.
Putting equivalent but subtle textures on the separate surfaces will enhance the eye`s ability to lock onto the two fields as one.
1) The neutral point where the drawn image is at the depth of the screen should be your (x,y,0) coordinate (i.e. z=0). At this point, both colors are exactly on top of each other.
2) For infinite depth, the maximum distance the two colors should be (in parallel) is the distance between the user's eyes, about 5cm, representing the two eyes gazing in parallel (=> inf).
3) Item's in front of the screen, should reverse color, so the viewer is cross-eyed and can go to nearly any extremum towards the user, although like real life, trying to view them may be impossible.
4) The only other variable is the distance the viewer is from the screen. This is the primary thing to know if you want calibrated distance (like having an exact point in front of the screen you want the object to float--otherwise everything is skewed. Perhaps su
@LeFreq
LeFreq / markupv1
Last active July 31, 2018 21:02
markup to end all markups
Proposed "Creole" for web markup (html, giteditors, etc). v1.x
<CR> sufficient and necessary for line-break (no separate LF)
nested, multi-emphasized text should be stack-based (reverse-ordered)?
where start and end syntax are the same they are noted by no adjacent inner spaces.
BEGINBEGINBEGIN
*bold*
/italics/ /*bold and italics*/
_underlined_
!blinking text! (e.g. warnings)
@LeFreq
LeFreq / language-optimization
Last active May 31, 2019 20:15
Unix command distillation
There should be need of only 4 machine code commands +/-1.
*MOVE,
*JUMP-ON-EQUAL (or JUMP-ON-NOT-EQUAL)
*OR,
*AND, and
*NOT.
These five can build 5 more hardware-level commands (STUB):
* allocate memory
* store data
Meta macros will help encode the PositionOS project and add the possibility of OOP within assembly.
A Metamacro takes a NAME and the number of parameters, creating a new macro with the NAME given which has the same number of parameters as the value given.
A meta-macro asm.
@LeFreq
LeFreq / gist:586c197312db4027e8d30fe4c041095d
Last active October 20, 2019 13:09
Intellectual Property
IP for software is now worked out with help from Stallman who claimed that there is no IP and Lessig who was continuing to evaluate the law with respect to software.
There is intellectual property, but it does not protect the actual code (which is covered under copyright), nor even the algorithm (as defined by the implementation of an idea). No, the idea alone is protected and different algorithms could conceivably be used to implement the idea.
For example, the idea of hexadecimal notation for use in computers is patentable, but the actual code or even nomenclature (FF for 255 decimal) is not.