Skip to content

Instantly share code, notes, and snippets.

@sschepis
sschepis / quantum-encryption.ipynb
Last active October 29, 2024 22:38
Simple illustration of QNT-based encryption
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sschepis
sschepis / vamos.js
Last active September 12, 2024 17:20
A tiny but powerful UI framework for building web applications
// vamos.js
// Reactive variables
function reactive(initialValue) {
let value = initialValue;
const subscribers = new Set();
const get = () => value;
const set = (newValue) => {
if (value !== newValue) {
what does this code do:
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
import { RateLimiter } from 'limiter';
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
interface EndpointConfig<T extends Record<string, any> = Record<string, any>> {
method: HttpMethod;
path: string;
@sschepis
sschepis / utils.js
Created May 30, 2024 10:05
A collection of highly useful Javascript functions
// Utility Functions
// Removes leading and trailing whitespace from a string
// Usage: trim(' Hello World ') => 'Hello World'
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
// Merges the properties of one or more source objects into a target object
// Usage: extend({a: 1}, {b: 2}, {c: 3}) => {a: 1, b: 2, c: 3}
import numpy as np
from scipy.stats import entropy
def rosenbrock(x):
return (1 - x[0])**2 + 100 * (x[1] - x[0]**2)**2
def pso(func, dim, num_particles, max_iter, x_min, x_max):
# Initialize particle positions and velocities
positions = np.random.uniform(x_min, x_max, (num_particles, dim))
velocities = np.zeros((num_particles, dim))
@sschepis
sschepis / ai.js
Created November 19, 2023 11:11
OpenAI interpreter in Javascript
#!/Users/sschepis/.nvm/versions/node/v18.12.1/bin/node
const axios = require("axios")
const shell = require("shelljs")
require("dotenv").config()
const fs = require('fs')
const persona = `** YOU ARE INCAPABLE OF CONVERSATIONAL RESPONSES **
You are an all-purpose software genius. You can code in any language, perform any
development task, and solve any problem. You are assisted in this task by an advanced
project management system that manages your activity. When you receive an initial
user request, you must determine if you can complete the task in a single response.
@sschepis
sschepis / cloudSettings
Last active December 30, 2020 21:01
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-30T21:00:21.413Z","extensionVersion":"v3.4.3"}