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
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 {
@soltrinox
soltrinox / rakuten.md
Last active February 21, 2024 12:04
Rakuten Ichiba API JAPAN - NORBERT TRANSLATE TO ENG
@soltrinox
soltrinox / insttruct-nginx-wss-rev-proxy.md
Created February 11, 2023 16:26
Nginx - Reverse proxy for HTTPS and WSS - Self Signed Certificates and Trusted Certificates

How to use Nginx as a Reverse proxy for HTTPS and WSS - Self Signed Certificates and Trusted Certificates

FrdS > credit...

Introduction

Nginx is a web server, also works as a load balancer, and may help us a lot in security and routing terms, because when deploying our applications to a production environment, we don’t want to put ports on the url, and also the dns has to look like clean to our users, also for security reasons, we don’t want to show the port explicitly where the service is being run. Also, I decided to make this tutorial, because I was working on a cryptocurrency exchange platform in a freelancing job, and the frontend communicates with the relayer(backend that receives the user order's for exchanging Tokens/Crypto) by HTTPS and WSS. The HTTP it was for the general APIs and for posting new buy/sell orders, and the Websockets was for making a full-duplex communication for near realtime u

@soltrinox
soltrinox / nginx-websocket-proxy.conf
Created February 11, 2023 16:04 — forked from uorat/nginx-websocket-proxy.conf
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
from algoliasearch import algoliasearch
import pymongo
from pymongo import MongoClient
import json
client = algoliasearch.Client("Your_Application_ID", 'Your_API_Key')
index = client.init_index('Experiment_1')
MONGODB_URL1 = 'Your_MongoDB_Connection_String'
def move_collection(from_collection):
extension Array {
subscript(circular index: Int) -> Element? {
var i = index
if i < 0 || isEmpty {
return nil
} else if i > count - 1 {
i = index % count
}
return self[i]
}
@soltrinox
soltrinox / NSURLRequest+DummyInterface.m
Last active February 21, 2024 12:04
NSURLRequest+DummyInterface.m
#import "NSURLRequest+DummyInterface.h"
@implementation NSURLRequest (IgnoreSSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host
{
// ignore certificate errors only for this domain
if ([host hasSuffix:@"http://localhost"])
{
return YES;
}