Skip to content

Instantly share code, notes, and snippets.

View soltrinox's full-sized avatar
🤖
Building Cybernetic Systems

Mr. Rosario soltrinox

🤖
Building Cybernetic Systems
View GitHub Profile

Polynomial Ring and Ideal Lattice in JavaScript

Given the mathematical concepts of Polynomial Ring and Ideal Lattice, we can implement them in JavaScript.

Definitions:

  1. Polynomial Ring: A polynomial ring is a set of polynomials in one or more indeterminates with coefficients in another ring,
  2. often a field. The polynomial ring, $$( K[X] )$$, in ( X ) over a field ( K ) can be defined as the set of expressions,
  3. called polynomials in ( X ), of the form: $$[ p = p_m X^m + p_{m-1} X^{m-1} + ... + p_1 X + p_0 ]$$
# Make sure you have Anaconda installed
# This tutorial assumes you have an Nvidia GPU, but you can find the non-GPU version on the Textgen WebUI github
# More information found here: https://github.com/oobabooga/text-generation-webui
conda create -n textgen python=3.10.9
conda activate textgen
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
python -m pip install -r requirements.txt
# this tutorial assumes conda and git are both installed on your computer
conda create -n tg python=3.10.9
conda activate tg
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
git clone https://github.com/oobabooga/text-generation-webui.git
cd text-generation-webui
pip install -r requirements.txt
# GPU only:
@soltrinox
soltrinox / verbs.activity.classifiers.csv
Created September 3, 2023 14:09
ACTIVITY CLASSIFIERS - ML
accept Indicates that that the actor has accepted the object. For instance a person accepting an award or accepting an assignment.
access Indicates that the actor has accessed the object. For instance a person accessing a room or accessing a file.
acknowledge Indicates that the actor has acknowledged the object. This effectively signals that the actor is aware of the objects existence.
add Indicates that the actor has added the object to the target. For instance adding a photo to an album.
agree Indicates that the actor agrees with the object. For example a person agreeing with an argument or expressing agreement with a particular issue.
append Indicates that the actor has appended the object to the target. For instance a person appending a new record to a database.
approve Indicates that the actor has approved the object. For instance a manager might approve a travel request.
archive Indicates that the actor has archived the object.
@soltrinox
soltrinox / cynics.wisdom.md
Created September 3, 2023 14:06
CYNICS WISDOM

The Cynic's Book of Wisdom:

  • Never discount the possibility you might live through it.
  • In the end you, you are the only answer to the question: What to do?
  • Sometimes you get a miracle. Don't expect another one.
  • Before declaring victory over your opponent, make sure you are playing the same game.
  • Sometimes the crazy person is right.
  • Nothing is so destructive as what we believe to be true.
  • The past is always waiting.
  • You are in more danger from the other person's God than your own.

Color Text Bash

https://misc.flogisoft.com/bash/tip_colors_and_formatting

https://app.monosketch.io/

{"root":{"i":"02-AA82jhUlVl_lYAUgDoWq7rg-l2c","v":451245924,"ss":[{"type":"T","i":"02-AA0BnhUgRReYj8Xk_xQZTJSIgaO","v":1137159506,"b":"0|0|9|4","t":"ABCDEFG123","e":{"be":{"fe":false,"fu":"F1","be":true,"bu":"S3","du":"1|0|0","rc":"NNNN"},"tha":1,"tva":1}},{"type":"T","i":"02-AAKuHiUHPuQjb115E70bSjppxla","v":43213769,"b":"8|0|9|4","t":"HIJKLM!45*","e":{"be":{"fe":false,"fu":"F1","be":true,"bu":"S3","du":"1|0|0","rc":"NNNN"},"tha":1,"tva":1}},{"type":"T","i":"02-AADnJiUB-pftBeOdyGLBlX0cw_d","v":-2091017348,"b":"0|3|9|4","t":"NOPQRST678","e":{"be":{"fe":false,"fu":"F1","be":true,"bu":"S3","du":"1|0|0","rc":"NNNN"},"tha":1,"tva":1}},{"type":"T","i":"02-AAVgNiUggLc9eBQLBbJMRJJJ8nU","v":-1828829421,"b":"8|3|9|4","t":"UVWXYZ?90#","e":{"be":{"fe":false,"fu":"F1","be":true,"bu":"S3","du":"1|0|0","rc":"NNNN"},"tha":1,"tva":1}}]},"extra":{"name":"Undefined"},"version":1,"modified_timestamp_millis":16882670966
const β = require('bignumber.js');
function Ω(a, m) {
const b = new β(a).mod(m);
for (let x = new β(1); x.lt(m); x = x.plus(1)) {
if (b.times(x).mod(m).eq(1)) {
return x;
}
}
return new β(1);

Problem

A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.

Investigation

@soltrinox
soltrinox / math.md
Last active February 21, 2024 12:03
MATH LATEX GENERATION

MATH LATEX GENERATION

https://latex.codecogs.com/eqneditor/editor.php

$$\sum_{x\rightarrow \infty }^{1}{\color{Red} \in }\int_{x}^{-1}\cdot \begin{bmatrix} x^1+y^2+z^3\ \end{bmatrix}$$

$$R = \left[\left(x,w\right):x \in {\mathcal{L}},w \in W\left(x\right)\right]$$

@soltrinox
soltrinox / swift.rest.wss.md
Created March 18, 2023 02:37
SwiftUi secure rest upgrade to websocket if available

COMMAND : write the swiftui code to connect to a secure REST service and upgrade to a secure websocket if available

Here's an example of how to use SwiftUI to connect to a secure REST service and upgrade to a secure WebSocket if available using URLSession and URLSessionWebSocketTask:

import SwiftUI
import Combine

class DataService: ObservableObject {