Skip to content

Instantly share code, notes, and snippets.

#!ipxe
kernel https://pxe.factory.talos.dev/image/a126c838c9325140f492444bbb10e7854a720c65bae129defd2d9581e4d57e90/v1.6.7/kernel-amd64 talos.platform=metal console=ttyS0 console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 siderolink.api=https://asoslab.siderolink.omni.siderolabs.io?jointoken=DBYQQHOiqjC4J7JxLt1sG6wZnpJKLs69wksbqOLjeAd talos.events.sink=[fdae:41e4:649b:9303::1]:8090 talos.logging.kernel=tcp://[fdae:41e4:649b:9303::1]:8092
initrd https://pxe.factory.talos.dev/image/a126c838c9325140f492444bbb10e7854a720c65bae129defd2d9581e4d57e90/v1.6.7/initramfs-amd64.xz
boot
#!ipxe
# Set source URI
set mirror http://download.fedoraproject.org/pub/fedora/linux/releases/38
# Detect CPU architecture and calculate repository URI
cpuid --ext 29 && set arch x86_64 || set arch i386
set repo ${mirror}/Everything/${arch}/os
# Start installer
@taosx
taosx / strcmp.ts
Created June 1, 2023 07:52
strcmp for uint8array in javascript/typescript
// not tested (just a test)
// fastest I've tested on chrome
function strcmpBitWise(a: Uint8Array, b: Uint8Array): number {
var diff;
for (let i = 0; i < Math.min(a.length, b.length); i++) {
diff = a[i] ^ b[i];
if (diff !== 0) return diff;
}
return a.length - b.length;

Interview Preparation

Created: Mar 19, 2020 4:37 PM Tags: Golang, Linux

When using an empty struct?

  • When you want to save some memory.
  • When implementing a data set.
  • When writing a seen hash
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom" xmlns:dc="https://purl.org/dc/elements/1.1/"
xmlns:content="https://purl.org/rss/1.0/modules/content" xmlns:newsmail="//">
<channel>
<title>Daily Insider Newsletter</title>
<link>https://eprod.ncinsider.com/site-services/newsletters/daily-insider-newsletter/</link>
<atom:link href="https://eprod.ncinsider.com/feeds/fulltext/newsletter/daily-insider-newsletter" rel="self" type="application/rss+xml"></atom:link>
<description>Daily Insider Newsletter from the The Insider North Carolina State Government News Service newspaper in The Triangle.</description>
<language>en</language>
from typing import Optional, List, Any
from marshmallow import Schema, fields, pprint
class Structure(object):
_fields = []
def _init_arg(self, expected_type, value):
if isinstance(value, expected_type):
return value
import React, { Component, useState, useEffect, useRef } from "react"
import BackgroundImage from "gatsby-background-image"
import style from "./index.module.css"
// props: data.allFile.edges[].node.childImageSharp.fluid
class BackgroundSliderMain extends Component {
state = {
current: 0,
edgeIndex: 0,
function FindProxyForURL(url, host) {
host = host.toLowerCase();
if (shExpMatch(host, "*.nandomedia.com") || shExpMatch(host, "*.adobe.com")){
return "SOCKS 127.0.0.1:1337"; // (IP:port)
}
return "default";
}
@taosx
taosx / psql_migration.re
Created March 11, 2019 08:39
How you could improve this code?
let getMigrations: string => array(string) =
migrationsPath => Node.Fs.readdirSync(migrationsPath);
let readContent: string => string =
migrationFilePath => Node.Fs.readFileAsUtf8Sync(migrationFilePath);
let handleError = Js.String.make;
let countMigrations:
Postgres.client => Js.Promise.t(Belt.Result.t(int, Js.Promise.error)) =
type badStates =
| ECONNREFUSED /* database not running, or running on different port */
| SHUTTING_DOWN
| STARTING_UP
| ERROR(string);
let db_state = xs => (
Js.String.includes("ECONNREFUSED", xs),
Js.String.includes("is shutting down", xs),