Skip to content

Instantly share code, notes, and snippets.

View matchaxnb's full-sized avatar

Matcha matchaxnb

View GitHub Profile
@matchaxnb
matchaxnb / binary_search_stuff.py
Created December 19, 2023 22:28
binary search stuff, for fun
"""we play with large sorted integer arrays"""
import timeit
from typing import Union, Tuple
import random
ar_a = list(range(0, 10))
ar_b = list(range(-5, 5, 1))
ar_c = list(range(-100, 100))
ar_d = list(range(90, 101))
@matchaxnb
matchaxnb / jsontovars.py
Created August 3, 2023 23:07
GitLab JSON variables to POSIX shell variables
#!/usr/bin/env python
"""jsontovars.py: parse GitLab API /projects/<id>/variables endpoint and export as shell variables"""
import sys
import json
data = json.load(sys.stdin)
for item in data:
if item['variable_type'] != 'env_var':
continue
print(f"""export {item['key']}="{item['value']}" """)
@matchaxnb
matchaxnb / using-vscode.md
Created April 7, 2023 14:45
Using VS Code on WSL2 from another machine

Using VS Code on WSL2 from another machine

This has become a problem since Microsoft Store apps can't be executed from session 0, i.e. not from a SSH session. Pity.

Fortunately, there's the Remote Tunnel option.

To use it, download the VS Code server and run it on your machine as follows:

./code tunnel

You: give me a lesson on neural networks, for a computer engineer with a good understanding of maths and what NN AI can do but a total lack of experience in the domain.

ChatGPT: Sure, I'd be happy to give you an introduction to neural networks!

At a high level, a neural network is a type of machine learning algorithm that's modeled after the structure and function of the human brain. Like the brain, a neural network is composed of many interconnected processing units, or "neurons", that work together to solve complex problems.

Neural networks have become extremely popular in recent years because they're able to learn and generalize from large amounts of data, making them ideal for tasks such as image classification, speech recognition, and natural language processing.

Here's a brief overview of how neural networks work:

{
"basics": {
"name": "Matcha (Chloe) Desoutter",
"label": "Staff Software Engineer",
"summary": "I am passionate about engineering, engineers, developer experience, and problem solving. I started my career in backend engineering, pushed forward with R&D, helped a number of companies transition to DevOps, and now take pride in forming communities of engineers centered around problem solving, tech stacks, and improving efficiency in this post-COVID world in which physical spaces are harder to navigate. I'm obsessive about defining the problem space well and love delivering the right solution at the right time. I also love programming and constructing beautiful software designs.\n",
"email": "ds.tt.rc@gmail.com",
"phone": "+33659906332",
"url": "https://matchaxnb.github.io",
"pro files": [
{
@matchaxnb
matchaxnb / gist:e1d38bfd5df5c5f35b209471cc59217c
Last active December 8, 2022 22:07
A star trek and Stargate crossover

Please write a star trek Stargate crossover fanfic on the premises that the Stargate earth is from the mirror universe.

Once upon a time in a distant part of the galaxy, the Earth of the Stargate universe was revealed to be from the mirror universe. This alternate Earth was a dark and violent place, where the strong ruled over the weak and selfishness was the norm.

In this universe, the SGC (Stargate Command) was run by ruthless and power-hungry individuals who cared only about their own ambitions. They saw the Stargate as a tool to conquer and enslave other worlds, rather than a means of exploration and diplomacy.

One day, a team from the SGC stumbled upon a Stargate from the regular universe. They were shocked to discover that this gate led to the planet Abydos, which was ruled by the benevolent and wise alien Ra.

Ra, sensing the darkness within the SGC team, refused to let them through the gate. But the team was determined to find a way to Abydos and its riches. They managed to steal a prototype of t

import { InputError } from '@backstage/errors';
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
import { Logger } from 'winston';
import {
PluginTaskScheduler,
TaskScheduleDefinition,
} from '@backstage/backend-tasks';
type IdentifyingName = string;
type StringLocation = string;
@matchaxnb
matchaxnb / gitlab-url.sh
Last active June 3, 2022 16:30
GitLab-URL
#!/bin/sh
# Take a local path. Make the GitLab URL for it. Assumes you use git remotes for Fetch
TGT=$(realpath $1)
GITLAB_SERVER="${GITLAB_SERVER:-https://gitlab.com}"
the_remote_path=$(git -C $(dirname "$TGT") remote show -n origin | grep Fetch | head -n 1 | cut -d: -f3)
the_root_path=$(git -C $(dirname "$TGT") rev-parse --show-toplevel)
the_remote_path=${the_remote_path%.git}
the_active_branch=$(git -C $(dirname "$TGT") symbolic-ref --short HEAD)
@matchaxnb
matchaxnb / math.py
Created May 12, 2022 10:21
Do arithmetic operations from command line shell script input - once and for all.
#!/usr/bin/env python
"""Usage: math [sum|mean|median|min|max]
Do these fucking maths once and for all from shell input.
"""
import sys
op = sys.argv[1]
da = [float(f) for f in sys.stdin.readlines()]
@matchaxnb
matchaxnb / fetch-public-trackers.py
Last active January 30, 2022 04:09
Tools to generate public torrents. Very useful when releasing open source distros or open source big works
#!/usr/bin/env python
"""
fetch-public-trackers.py: generate a list of public trackers
use this to release open source software to public trackers.
uses bs4 and requests
"""
from bs4 import BeautifulSoup
import requests