Skip to content

Instantly share code, notes, and snippets.

View QuixThe2nd's full-sized avatar
🏠
Working from home

Parsa Yazdani QuixThe2nd

🏠
Working from home
View GitHub Profile
@QuixThe2nd
QuixThe2nd / MapFS.js
Last active September 1, 2025 09:38
A class built on Map with filesystem support (Both TS and JS versions)
import fs from 'fs';
export default class MapFS {
map = new Map();
path;
constructor(path) {
this.path = path;
if (!fs.existsSync(path)) fs.writeFileSync(this.path, '[]', 'utf8');
this.map = new Map(JSON.parse(fs.readFileSync(path, 'utf8')));
@QuixThe2nd
QuixThe2nd / wrtc-simple-peer.ts
Created April 5, 2025 11:27
Perfect Handshake Negotiation Using Simple Peer
import WebSocket from 'ws'
import { v4 as uuidv4 } from 'uuid';
import Peer, { type Instance as PeerInstance } from 'simple-peer'
import WebRTC from '@roamhq/wrtc'
type AnnounceMessage = {
type: 'announce'
from: string
}
@QuixThe2nd
QuixThe2nd / webrtc_multicast.ts
Last active November 1, 2024 01:15
WebRTC Multicast
/*
This is a simple multicast implementation using WebRTC. This script was built for Deno in Typescript, but works in Node and Web environments too.
It uses WebSocket rooms for signalling. It uses a freely available WebSocket server by default. To use your own, see `https://github.com/weisrc/rooms`.
*/
import { RTCDataChannel, RTCIceCandidate, RTCPeerConnection, RTCSessionDescription } from "npm:werift";
type Message = { announce: true; from: number } | { offer: RTCSessionDescription; from: number; to: number } | { answer: RTCSessionDescription; from: number; to: number } | { iceCandidate: RTCIceCandidate; from: number; to: number };
type PeerConnection = { conn: RTCPeerConnection; channel: RTCDataChannel; iceCandidates: RTCIceCandidate[] };
@QuixThe2nd
QuixThe2nd / open_signing_schema.md
Created November 17, 2023 03:57
Open Signing Schema

Open Signing Schema

This is the documentation for the open signing schema used by Starfiles. API endpoints supporting this schema can be used as a drop-in replacement for Starfiles Signing API.

Example Base Endpoint: https://sign-microservice.starfiles.co

Method: GET

Parameters

  • ipa (required): Starfiles file ID of IPA.
@QuixThe2nd
QuixThe2nd / index.php
Created April 14, 2021 13:19
Detect VPNs PHP
function usingVPN(){
foreach(['HTTP_VIA','HTTP_FORWARDED_FOR','HTTP_X_FORWARDED','HTTP_FORWARDED','HTTP_CLIENT_IP','HTTP_FORWARDED_FOR_IP','VIA','X_FORWARDED_FOR','FORWARDED_FOR','X_FORWARDED','FORWARDED','CLIENT_IP','FORWARDED_FOR_IP','HTTP_PROXY_CONNECTION'] as $x){
if(isset($_SERVER[$x])){
return true;
}
}
return false;
}
if(usingVPN())
echo 'VPN Detected.'