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
@soltrinox
soltrinox / nginx.google.conf
Created January 5, 2024 03:37 — forked from liweitianux/nginx.google.conf
Nginx Proxy to Google
#
# Nginx reverse proxy to Google Search (with images and webcache))
#
# Credit:
# * Nginx rewrite append a parameter at the end of an URL
# https://serverfault.com/a/311660/387898
# * https://github.com/tracycool/Reverse-Proxy-for-Google
# * https://github.com/caiguanhao/nginx-bypass-gfw/blob/master/google.conf
#
# References:
@soltrinox
soltrinox / RecordAudio.swift
Created December 24, 2023 18:51 — forked from leonid-s-usov/RecordAudio.swift
Swift Audio Recording class. Reads buffers of input samples from the microphone using the iOS RemoteIO Audio Unit API
//
// RecordAudio.swift
//
// This is a Swift class (updated for Swift 5)
// that uses the iOS RemoteIO Audio Unit
// to record audio input samples,
// (should be instantiated as a singleton object.)
//
// Created by Ronald Nicholson on 10/21/16.
// Copyright © 2017,2019 HotPaw Productions. All rights reserved.
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);
@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

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):
@otmb
otmb / ContentView.swift
Last active April 18, 2024 18:37
WKWebView can read a wasm from a localfile with XMLHttpRequest, but returns an error with fetch
import SwiftUI
import WebKit
enum WebViewError: Error {
case contentConversion(String)
case emptyFileName
case inivalidFilePath
var message: String {
switch self {
@liweitianux
liweitianux / nginx.google.conf
Created July 17, 2021 03:44
Nginx Proxy to Google
#
# Nginx reverse proxy to Google Search (with images and webcache))
#
# Credit:
# * Nginx rewrite append a parameter at the end of an URL
# https://serverfault.com/a/311660/387898
# * https://github.com/tracycool/Reverse-Proxy-for-Google
# * https://github.com/caiguanhao/nginx-bypass-gfw/blob/master/google.conf
#
# References:
@soltrinox
soltrinox / BOUNDARIES.txt
Last active March 31, 2022 08:41
HOW TO DO BOUNDARIES RIGHT IN YOUR LIFE
`
HOW TO DO BOUNDARIES RIGHT IN YOUR LIFE:
[ PSYCHOLOGICAL DEFENSE SERIES ] TITLE: Establishment of CONSCIOUS violation vs. UNCONSCIOUS violation of BOUNDARIES and the protocol for delivery of CONSEQUENCE due to BOUNDARY VIOLATION.
[DANGER DO NOT READ THIS PROTOCOL IF YOU HAVE INSECURITIES AND OR ARE OPERATING WITH PATHOLOGICAL INTENT ]
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! THIS IS A RAW PSYCH SELF-DEFENSE SYSTEM ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
[DANGER DO NOT READ THIS PROTOCOL IF YOU HAVE INSECURITIES AND OR ARE OPERATING WITH PATHOLOGICAL INTENT ]
@soltrinox
soltrinox / gist:7ec1184d10d1a0867fb489377e2ab665
Last active March 26, 2021 22:01
BOUNDARY / CONSEQUENCE VIOLATION PROTOCOL >> A-Z STEPS
HOW TO DO BOUNDARIES RIGHT IN YOUR LIFE: 
[ PSYCHOLOGICAL DEFENSE SERIES ] TITLE: Establishment of  CONSCIOUS violation vs. UNCONSCIOUS violation of BOUNDARIES and the protocol for delivery of CONSEQUENCE due to BOUNDARY VIOLATION.
 
[DANGER DO NOT READ THIS PROTOCOL IF YOU HAVE INSECURITIES AND OR ARE OPERATING WITH PATHOLOGICAL INTENT ]
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! THIS IS A RAW PSYCH SELF-DEFENSE SYSTEM ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
[DANGER DO NOT READ THIS PROTOCOL IF YOU HAVE INSECURITIES AND OR ARE OPERATING WITH PATHOLOGICAL INTENT ]
-------------------
@nandorojo
nandorojo / use-swr-infinite-enhanced.ts
Last active July 10, 2023 11:01
useSWRInfinite with pagination & typescript safety
import { ConfigInterface, useSWRInfinite } from 'swr'
import { useMemo, useCallback, useRef } from 'react'
import last from 'lodash.last'
import get from 'lodash.get'
type PageKeyMaker<Page, Key extends any[]> = (
index: number,
previousPageData?: Page
/**
* Mutable ref object. Set this to `true` before the request and `false` afterwards if the request is fetching more.