Skip to content

Instantly share code, notes, and snippets.

View ugudango's full-sized avatar

Gârleanu Alexandru-Ștefan ugudango

View GitHub Profile
@ugudango
ugudango / char_at.c
Created April 7, 2021 06:48
Unix File Reading using Chunking
#define CHUNK_SIZE 256
char char_at(int fd, long long at, enum Direction D) {
static int FD;
static long long left, right;
static char CHUNK[CHUNK_SIZE];
// If outside the file, stop this function.
long long min = lseek(fd, 0, SEEK_SET), max = lseek(fd, 0, SEEK_END);
if (at < min || at >= max) return -1;
"use strict";class e{_endpoints=new Map;getEndpoint(e){return this._endpoints.get(e)??(()=>{console.error(`Endpoint ${e} non-existent or malformed.`)})}setEndpoint(e,t){this._endpoints.set(e,t)}_defaultEndpointAction=()=>{};get defaultEndpointAction(){return this._defaultEndpointAction}set defaultEndpointAction(e){"function"==typeof e&&(this._defaultEndpointAction=e)}}class t{endpointRegistry=new e;context;config={contextTokens:{fetch:"$get",call:"$call",remoteCall:"$callRemote"}};_self;_responseCallbacks={};constructor(e,n=(()=>null)){var s,o,r,i,a;null===n()&&(s=this.endpointRegistry,n=e=>{const t=e[1];return"endpoint"in t?s.getEndpoint(t.endpoint)(t):s.defaultEndpointAction(t)}),this._self=e,this.postMessage=(o=t._getNextId(),r=this._responseCallbacks,i=this._self,e=>{const t=o.next().value;return new Promise(((n,s)=>{Object.defineProperty(r,t,{writable:!1,configurable:!0,value:(e,t)=>e?s(new Error(e.message)):n(t)}),i.postMessage([t,e])}))}),this.makeRequest=(a=this.postMessage,(e,t)=>{const n=t;return n.
importScripts('https://gist.githubusercontent.com/ugudango/fde5d2d6a07bc069773f4ce26b9445bd/raw/cc26c232f2b775c9ee14370640fcd72fb98424e7/t.js');
tile.context.testField.$get.then((r) => tile.log(r));
tile.context.testFunc.$call(3, 2).then((r) => {
tile.log(r);
});
@ugudango
ugudango / vm_guide.md
Created October 9, 2022 21:55
How I set up my ASUS ROG STRIX G15 (2021) for dGPU passthrough

Step 0:

Make sure you've got everything needed for C++ compilation and more. This is part of base-devel, and you should be able to figure out how to install it on Arch / Manjaro.

Step 1:

Install the proprietary nVidia drivers. Follow the Manjaro Wiki Guide. For most operations, you'll use mhwd, which is Manjaro's driver management utilty. In my case, I did a PRIME offload setup, with hybrid drivers.

Step 2:

@ugudango
ugudango / windev.md
Last active November 12, 2024 10:38

Windows Development Setup

I love Linux. But the NVIDIA drivers are broken on Wayland (again), and I need to work to be able to pay my rent.

So let's dive deep into this, by configuring this nice operating system that's pinning TikTok and Candy Crush Saga to my start menu.