Drafts

Draft and unpublished posts

0 posts simple view
from kedro.pipeline import node

node(
    input="raw",
    output="int",
    func=my_func,
    tags=["one"],
)

Upon first running an aws cli command using localstack you might end up with the following error.

Unable to locate credentials. You can configure credentials by running "aws configure".

Easy way #

The easy easiest way is to leverage a package called awscli-local.

pipx install awscli-local

Leveraging the awscli #

If you want to use the cli pro

pipx install awscli

aws config --profile localstack
# put what you want for the keys, but enter a valid region like us-east-1

alias aws='aws --endpoint-url http://localhost:4566 --profile localstack'
npx create-react-app todoreact
import React,{useState,useEffect} from 'react';
import './App.css';

function App() {
  const [data,setData]=useState([]);
  const [newName,setNewName]=useState([]);
  const getData=()=>{
    fetch('/api'
    ,{
      headers : {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
       }
    }
    )
      .then(function(response){
        return response.json();
      })
      .then(function(myJson) {
        setData(myJson)
      });
  }
  useEffect(()=>{
    getData()
  },[])

  const addItem= async () => {
    const rawResponse = await fetch('/api/add/', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },

    body: JSON.stringify({"name": newName})
    });
    const content = await rawResponse;

    console.log(content);
    getData()
  }




  return (
    <div className="App">
     {
       data && data.length>0 && data.map((item)=><p>{item.id}{item.priority}{item.name}<button>raise priority</button></p>)
     }
    <input type='text' value={newName} onChange={(e) => (setNewName(e.target.value))} />
    <button onClick={addItem} >add item</button>
    </div>
  );
}

export default App;

Hatch allows you to specify direct references for dependencies in your pyproject.toml file. This is useful when you want to depend on a package that is not available on PyPI or when you want to use a specific version from a Git repository. Often used for unreleased packages, or unreleased versions of packages.

docs

[project]
dependencies = ['markata', 'markata-todoui@git+https://github.com/waylonwalker/markata-todoui']

[tool.hatch.metadata]
allow-direct-references=true

Setting up snapper on Arch

https://www.youtube.com/watch?v=_97JOyC1o2o snapper snap-pac grub-btrfs Note # [1] These are mostly my notes to remind myself, I’d Highly reccomend watching this-video [2] or reading this arch wiki page [3] /.snapshots already exists error # [4] When I started running sudo snapper -c root create-config / I ran into the following error. [5] Creating config failed (creating btrfs subvolume .snapshots failed since it already exists). remove existing snapshots # [6] sudo umount /.snapshots sudo rm -r /.snapshots configure snapper # [7] sudo snapper -c root create-config / sudo snapper -c home create-config /home btrfs subvolumes # [8] sudo btrfs subvolume list / [9] sudo btrfs subvolume delete /.snapshots sudo mkdir /.snapshots # [10] # you might not see snapshots mounted yet lsblk # if you check fstab you will see an entry for it cat /etc/fstab # mount it sudo mount -a # now you should see /.snapshots mounted lsblk You should now see .snapshots in mountpoints. [11...
1 min read

{% for year in markata.map(“date.year”, filter=‘published’)|unique %}

{{ year }} #

{% for post in markata.map(‘post’, filter=“published and date.year == “+year|string, sort=‘date’) %}

  • [{{ post.title }} - {{ post.date.month }}/{{ post.date.day }}](/{{ post.slug }}) {% endfor %} {% endfor %}

Muck

Steam achievements and progress for Muck - 2.04% complete with 1/49 achievements unlocked.

5 min

sein

Steam achievements and progress for sein - 8.77% complete with 5/57 achievements unlocked.

5 min
a stable diffusion done with a111 web ui

xrandr is a great cli to manage your windows in a linux distro using x11, which is most of them. The issue is that I can never remember all the flags to the command, and if you are using it with something like a laptop using a dock the names of all the displays tend to change every time you redock. This makes it really hard to make scripts that work right every time.

Homepage #

Check out the deresmos/xrandr-manager for more details on it.

installation #

xrander-manager is a python cli application that is simply a nice interface into xrandr. So you must have xrandr already installed, which is generally just there on any x11 window manager, I’ve never had to install it.

As with any python cli that is indended to be used as a global/system level cli application I always install them with pipx. This automates the process of creating a virtual environment for xrandr-manager for me, and does not clutter up my system packages with its dependencies that may eventually clash with another that I want to use.

# prereqs (xrandr, pipx)
pipx install xrandr-manager

set main monitor #

First if your main display is not set to the correct monitor set your main display first.

xrandr-manager -m HDMI-0
xrandr-manager -m DP-0

prompt mode #

If you dont know the name of your monitors and and don’t want to dig through xrandr, you can just run --prompt and tab complete to fill set your main display.

xrandr-manager --prompt

direction #

This is what I most often use xrandr-manager for. Once you have the main display set you can tell it where to put the other monitor. I’ve only tried this with two monitors, I have no idea what happens with more monitors.

xrandr-manager -d right
xrandr-manager -d left
xrandr-manager -d above
xrandr-manager -d below

mirror #

One thing that I always need to jump through hoops to do is mirror. Occasionally I want to mirror so that more people can see the screen while we are split screen gaming. This has seemed like a pain in any other xrandr utility, but trivial in xrandr-manager.

xrandr-manager --mirror

It logs out the xrandr command #

One nice thing about xrandr-manager is that it echos out the xrandr command that it’s running. This is nice because you can toss this behind a hotkey or an init script.

Guis #

Ya there are guis that do this. I’ve had good luck with arandr. It’s more intuitive to drag windows around like what you would do in windows. Every once in awhile it messes up and my polybar overlaps my windows, or my windows end up only on half the screen.

There are also graphics card specific utilities, Ive used nvidia x server settings and it mostly works similar to arandr.

jq has some syntax that will sneak up on you with complexity. It looks so good, and so understandable, but everytime I go to use it myself, I don’t get it. ijq is an interactive alternative to jq that gives you and nice repl that you can iterate on queries quickly.

paru -Syu ijq

Here are some other articles, I decided to link at the time of writing this article.

JUT | Read Notebooks in the Terminal

Comprehensive guide to creating kedro nodes

Kedro - My Data Is Not A Table

I love getting faster in my workflow, something I have recently added in is creating GitHub repos with the cli. I often create little examples of projects, but they just end up on my machine and not anywhere that someone else can see, mostly because it takes more effort to go create a repo. TIL you can create a repo right from the command line and push to it immediately.

gh repo create waylonwalker-cli
gh-repo-create.webp

want to see what this repo I created is about? #

Check out what I created here.

pipx run waylonwalker

totally guessed at this post’s date

I’m still trying to understand this one, but this is how you force a python object to stop atexit.

import atexit

class Server:
    def __init__(
        self,
        auto_restart: bool = True,
        directory: Union[str, "Path"] = None,
        port: int = 8000,
    ):
        if directory is None:
            from markata import Markata

            m = Markata()
            directory = m.config["output_dir"]

        self.directory = directory
        self.port = find_port(port=port)
        self.start_server()
        atexit.register(self.kill)

    def start_server(self):
        import subprocess

        self.cmd = [
            "python",
            "-m",
            "http.server",
            str(self.port),
            "--directory",
            self.directory,
        ]

        self.proc = subprocess.Popen(
            self.cmd,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
        )
        self.start_time = time.time()


    def kill(self):
        self.auto_restart = False
        self.proc.kill()

    def __rich__(self) -> Panel:
        if not self.proc.poll():
            return Panel(
                f"[green]serving on port: [gold1]{self.port} [green]using pid: [gold1]{self.proc.pid} [green]uptime: [gold1]{self.uptime} [green]link: [gold1] http://localhost:{self.port}[/]",
                border_style="blue",
                title="server",
            )

        else:
            if self.auto_restart:
                self.start_server()

            return Panel(f"[red]server died", title="server", border_style="red")

Portal

Steam achievements and progress for Portal - 26.67% complete with 4/15 achievements unlocked.

4 min