Skip to content

Instantly share code, notes, and snippets.

View JustinStitt's full-sized avatar
👻
learning something new everyday!

Justin Stitt JustinStitt

👻
learning something new everyday!
View GitHub Profile
@JustinStitt
JustinStitt / kselftest-02
Created August 22, 2023 21:21
$ make mrproper && make LLVM=1 ARCH=x86_64 headers && make LLVM=1 ARCH=x86_64 -j128 -C tools/testing/selftests TARGETS=hid &> out
make: Entering directory '/usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests'
make[1]: Entering directory '/usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid'
INSTALL libbpf_headers
HOSTCC /usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid/tools/build/libbpf/fixdep.o
HOSTLD /usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid/tools/build/libbpf/fixdep-in.o
LINK /usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid/tools/build/libbpf/fixdep
CC /usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid/tools/build/libbpf/staticobjs/libbpf.o
CC /usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/hid/tools/build/libbpf/staticobjs/bpf.o
CC /usr/local/google/home/justinstitt/playg
@JustinStitt
JustinStitt / full-kselftest-V=1-output
Created August 22, 2023 20:33
$ make mrproper headers && make LLVM=1 ARCH=x86_64 -j128 V=1 -C tools/testing/selftests &> out
make: Entering directory '/usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests'
make[1]: Entering directory '/usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/alsa'
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
make[1]: Entering directory '/usr/local/google/home/justinstitt/playground/learning-to-build/linux/tools/testing/selftests/alsa'
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
Package alsa was not found in the pkg-config search path.
@JustinStitt
JustinStitt / kselftest-allyesconfig-with-LLVM=1
Created August 21, 2023 20:22
warnings for make LLVM=1 allyesconfig kselftest
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
In file included from progs/hid.c:6:
progs/hid_bpf_helpers.h:9:38: error: declaration of 'struct hid_bpf_ctx' will not be visible outside of this function [-Werror,-Wvisibility]
9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
| ^
progs/hid_bpf_helpers.h:18:15: error: declaration of 'enum hid_report_type' will not be visible outside of this function [-Werror,-Wvisibility]
18 | enum hid_report_type type,
@JustinStitt
JustinStitt / db.py
Created May 17, 2023 03:38
Singleton pattern in Python
class DB:
_instance = None
def __new__(cls):
if not cls._instance:
cls._instance = super(DB, cls).__new__(cls)
return cls._instance
def __init__(self):
import re
class Equation:
"""
A Class for representing a single equation in a system of equations.
In the form:
`2x_0 + 3x_1 - 4x_2 = 6`
from math import sqrt, ceil
from functools import reduce
def is_prime(n: int) -> bool:
"""
O(sqrt(n))
"""
return all([n % i != 0 for i in range(2, ceil(sqrt(n)) + 1)])
from dataclasses import dataclass, field
@dataclass
class AdjMat:
rep: list[list[int]] = field(default_factory=lambda: [])
@dataclass
class AdjLst:
import os
import openai
openai.api_key = "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"
# user, system, assistant
prompt = """
You are a vacation planner. The user will provide locations and prefered
climates. Then you will give them great vacation spots/activities.
If the user doesn't mention locations/vactions/climates or anything similar please

Consider the following Python code:

a = 7
g = lambda x: a * x
a = 2
g(10)