Skip to content

Instantly share code, notes, and snippets.

View Avaray's full-sized avatar
🙂
Looking for work

Avaray

🙂
Looking for work
View GitHub Profile
@Avaray
Avaray / 1-preparations.md
Last active February 3, 2025 12:19
How to convert OKLCH colors to RGB in Vite (and Frameworks like Astro)

Vite plugin for OKLCH to RGB conversion

Plugin is based on chroma-js package. You need to install it with one of following commands.

# Deno
deno i npm:chroma-js
# Bun
bun i chroma-js
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://dav.one/",
"loadingExperience": {
"initial_url": "https://dav.one/"
},
"lighthouseResult": {
"requestedUrl": "https://dav.one/",
"finalUrl": "https://dav.one/",
@Avaray
Avaray / 1-astro-config.md
Last active January 22, 2025 13:21
How to customize Shiki Syntax Highlighting in Astro using TailwindCSS V4

Astro Config

export default defineConfig({
  markdown: {
    // "shiki" | "prism" | false
    syntaxHighlight: "shiki",
    shikiConfig: {
      // Need to use any existing theme here to be able to overwrite colors in CSS
      // Keep in mind that each of themes has different colors
@Avaray
Avaray / vastai.ts
Created December 7, 2024 12:09
VASTAI TypeScript Machine Interface - created automatically with AI based on received objects
export interface Machine {
ask_contract_id: number;
bundle_id: number;
bundled_results: null | any; // Specify type if known
bw_nvlink: number;
compute_cap: number;
cpu_arch: string;
cpu_cores: number;
cpu_cores_effective: number;
cpu_ghz: number;
@Avaray
Avaray / nano_updater.py
Created August 19, 2024 07:21
Nano Editor Updater for RaspberryPi
# WORKS ON PYTHON 3.7.3
# DOESN'T WORK ON PYTHON 3.10.2 BECAUSE OF SSL IN URLLIB LIBRARY
# IT SEEMS PYTHON MUST BE COMPILED WITH OPENSSL (?)
import os
import re
import urllib.request
from datetime import datetime
CWD = os.path.dirname(os.path.abspath(__file__))
@Avaray
Avaray / index.ts
Last active August 4, 2024 06:55
Bun.sh - function to get GitHub-style hash for file
// When you are using GitHub Api to get contents from repository,
// file hashes will be different than hashes you get with 'sha1sum'.
// This example shows how you can get same hashes using Bun.sh
import { CryptoHasher } from 'bun';
async function getGitFileHash(filePath: string): Promise<string> {
const file = await Bun.file(filePath).arrayBuffer();
const content = new Uint8Array(file);
@Avaray
Avaray / BME280.py
Last active May 20, 2024 13:10
BME280 & BMP280 I2C Micropython Library for ESP32 based development boards
"""
BME280 & BMP280 I2C Micropython Library for ESP32 based development boards
Originally created by Foxdan
https://github.com/foxdan/ubme280
Modified by Avaray, including tiny cosmetic changes:
- using 'uctypes' instead of 'ctypes'
- using 'SoftI2C' instead of 'I2C' in example code
- using Pins 22 and 21 in example code
@Avaray
Avaray / index.html
Created January 17, 2024 14:04 — forked from bellbind/index.html
[chrome][android] BarcodeDetector example
<!doctype html>
<html>
<head>
<script type="module">
// WICG Shape Detection API
// - https://wicg.github.io/shape-detection-api/
try {
const start = document.getElementById("start");
const video = document.getElementById("video");
const result = document.getElementById("result");
@Avaray
Avaray / data.ts
Last active February 24, 2023 10:30
Battlefield 4 DATA
export const gamemodes: {[key: string]: string} = {
"AirSuperiority": "Air Superiority",
"CaptureTheFlag": "Capture The Flag",
"CarrierAssault": "Carrier Assault Small",
"CarrierAssaultLarge": "Carrier Assault Large",
"Chainlink": "Chainlink",
"ConquestLarge": "Conquest Large",
"ConquestSmall": "Conquest Small",
"Domination": "Domination",
"Elimination": "Defuse",
@Avaray
Avaray / playwright.js
Last active September 27, 2022 15:03
[NodeJS] Playwright Starter
const { chromium } = require('playwright-core');
// set browser to disable images loading
const browser = await chromium.launch({
headless: true,
executablePath: CHROMIUM_PATH_HERE,
args: [ '--blink-settings=imagesEnabled=false', '--window-size=800,800' ]
});
const page = await browser.newPage({ viewport: null });