Skip to content

Instantly share code, notes, and snippets.

View ansarizafar's full-sized avatar

Zafar Ansari ansarizafar

View GitHub Profile
@ansarizafar
ansarizafar / realtime.js
Created January 27, 2024 16:42 — forked from heapwolf/realtime.js
socket runtime realtime demo
import { network, Encryption } from 'socket:network'
import process from 'socket:process'
import Buffer from 'socket:buffer'
import fs from 'socket:fs'
window.onload = async () => {
const peerId = await Encryption.createId()
const signingKeys = await Encryption.createKeyPair()
const clusterId = await Encryption.createClusterId('asdfasdfasdfasdfas') // change this!
@ansarizafar
ansarizafar / readme.md
Created January 12, 2024 13:21 — forked from garth/readme.md
A Yjs provider for socketsupply

You can use it the same as you do with other yjs providers, but you have to pass it a socket which can be created with someting like this:

// set the peer id
const peerId = window.localStorage.getItem('peerId') ?? (await Encryption.createId())
window.localStorage.setItem('peerId', peerId)

// set the signing keys
const keySeed = window.localStorage.getItem('keySeed') ?? createId()
@ansarizafar
ansarizafar / readme.md
Created January 12, 2024 13:21 — forked from garth/readme.md
A Yjs provider for socketsupply

You can use it the same as you do with other yjs providers, but you have to pass it a socket which can be created with someting like this:

// set the peer id
const peerId = window.localStorage.getItem('peerId') ?? (await Encryption.createId())
window.localStorage.setItem('peerId', peerId)

// set the signing keys
const keySeed = window.localStorage.getItem('keySeed') ?? createId()
@ansarizafar
ansarizafar / readme.md
Created January 12, 2024 13:21 — forked from garth/readme.md
A Yjs provider for socketsupply

You can use it the same as you do with other yjs providers, but you have to pass it a socket which can be created with someting like this:

// set the peer id
const peerId = window.localStorage.getItem('peerId') ?? (await Encryption.createId())
window.localStorage.setItem('peerId', peerId)

// set the signing keys
const keySeed = window.localStorage.getItem('keySeed') ?? createId()
@ansarizafar
ansarizafar / clutter-free-vscode.jsonc
Created January 3, 2024 13:54 — forked from kamilogorek/_screenshot.md
Clutter-free VS Code Setup
// Required Plugin: https://marketplace.visualstudio.com/items?itemName=drcika.apc-extension
// settings.json
{
// Remove left-side icons
"workbench.activityBar.location": "hidden",
// Remove bottom status bar
"workbench.statusBar.visible": false,
// Remove position indicator in the editor's scrollbar
"editor.hideCursorInOverviewRuler": true,
@ansarizafar
ansarizafar / macos-app-icon.md
Created October 16, 2023 04:04 — forked from jamieweavis/macos-app-icon.md
How to create an .icns macOS app icon
@ansarizafar
ansarizafar / macos-app-icon.md
Created October 16, 2023 04:04 — forked from jamieweavis/macos-app-icon.md
How to create an .icns macOS app icon
class BottomIntersectionObserverController {
/** @type {HTMLElement} */
host;
/** @type {string} */
_bottomThreshold;
/** @type {CallableFunction} */
bottomThresholdReachedCallback;
@ansarizafar
ansarizafar / langchain.ipynb
Created May 1, 2023 07:43 — forked from jiamingkong/langchain.ipynb
Using RWKV in langchain
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()