This commit is contained in:
Harsh Shandilya 2024-03-31 17:43:01 +05:30
parent acbe260972
commit 88bb52ffff
6 changed files with 23 additions and 35 deletions

View File

@ -91,7 +91,7 @@ export default async (request: Request, context: Context) => {
},
{
status: Status.BadRequest,
}
},
);
// I want to be searchable as `@harsh@msfjarvis.dev`, so I only
// allow requests that set the resource query param to this value.
@ -102,7 +102,7 @@ export default async (request: Request, context: Context) => {
},
{
status: Status.BadRequest,
}
},
);
} else {
// Here's the JSON object we got earlier

View File

@ -12,7 +12,8 @@ tags:
- renovate
title: Tips and tricks for using Renovate
---
[Mend Renovate](https://www.mend.io/free-developer-tools/renovate/) is a free to use dependency update management service powered by the open-source [renovate](https://github.com/renovatebot/renovate), and is a compelling alternative to GitHub's blessed solution for this problem space: [Dependabot](https://docs.github.com/en/code-security/dependabot). Renovate offers a significantly larger suite of supported language ecosystems compared to Dependabot as well as fine-grained control over where it finds dependencies, how it chooses updated versions, and a lot more. TL;DR: Renovate is a massive upgrade over Dependabot and you should evaluate it if *any* aspect of Dependabot has caused you grief, there's a good chance Renovate does it better.
[Mend Renovate](https://www.mend.io/free-developer-tools/renovate/) is a free to use dependency update management service powered by the open-source [renovate](https://github.com/renovatebot/renovate), and is a compelling alternative to GitHub's blessed solution for this problem space: [Dependabot](https://docs.github.com/en/code-security/dependabot). Renovate offers a significantly larger suite of supported language ecosystems compared to Dependabot as well as fine-grained control over where it finds dependencies, how it chooses updated versions, and a lot more. TL;DR: Renovate is a massive upgrade over Dependabot and you should evaluate it if _any_ aspect of Dependabot has caused you grief, there's a good chance Renovate does it better.
I'm collecting some tips here about "fancy" things I've done using Renovate that may be helpful to other folks. You'll be able to find more details about all of these in their very high quality docs at [docs.renovatebot.com](https://docs.renovatebot.com/).
@ -26,9 +27,9 @@ There are times where you're sticking with an older version of a package (tempor
{
"managers": ["gradle"],
"packagePatterns": ["^com.squareup.okhttp3"],
"enabled": false,
},
],
"enabled": false
}
]
}
```
@ -40,13 +41,8 @@ Renovate already includes preset configurations for [monorepos](https://github.c
{
"packageRules": [
{
"managers": [
"cargo"
],
"matchPackagePatterns": [
"serde",
"serde_derive"
],
"managers": ["cargo"],
"matchPackagePatterns": ["serde", "serde_derive"],
"groupName": "serde"
}
]
@ -87,9 +83,7 @@ This is how the relevant configuration might look like with Renovate
{
"description": "Update Hugo version in Netlify config",
"fileMatch": [".toml$"],
"matchStrings": [
"HUGO_VERSION = \"(?<currentValue>.*?)\""
],
"matchStrings": ["HUGO_VERSION = \"(?<currentValue>.*?)\""],
"depNameTemplate": "gohugoio/hugo",
"datasourceTemplate": "github-releases"
}
@ -108,9 +102,9 @@ According to GitHub's [official recommendations](https://docs.github.com/en/acti
"extends": [
"config:base",
":dependencyDashboard",
"helpers:pinGitHubActionDigests",
 ]
}
"helpers:pinGitHubActionDigests"
]
}
```
## Automatically merging compatible updates
@ -125,7 +119,7 @@ Every person with a JavaScript project has definitely loved getting 20 PRs from
"description": "Automerge non-major updates",
"matchUpdateTypes": ["minor", "patch", "digest", "lockFileMaintenance"],
"automerge": true
},
}
]
}
```

View File

@ -5,10 +5,9 @@ summary: NixOS allows running arbitrary Docker containers declaratively, these
are some of my notes on my usage of this functionality.
draft: true
---
NixOS comes with the ability to [declaratively manage docker containers](https://nixos.wiki/wiki/NixOS_Containers#Declarative_docker_containers), which functions as a nice escape hatch when something you want to run doesn't have a native Nix package or is not easy to run within NixOS.
All the available configuration options can be found [here](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=alpha_desc&query=virtualisation.oci-containers.containers), so rather than explain all of it I'll just walk through my own experience of getting a container up for [Linkding](https://github.com/sissbruecker/linkding).
`podman containers list` works only if you're root, not with `sudo podman containers list`.
`podman containers list` works only if you're root, not with `sudo podman containers list`.

View File

@ -5,16 +5,11 @@ summary: We've all used Retrofit to interact with REST APIs for as long as we
can remember, but what if there was no API?
draft: true
---
Square's Retrofit is best known for being the gold standard of REST clients in the JVM/Android ecosystem, but it's excellent API design also lends itself to great extensibility which we will leverage today.
While trying to implement post search functionality in [Claw](https://msfjarvis.dev/g/compose-lobsters), my [lobste.rs](https://lobste.rs) client I stumbled into a *tiny* problem: there was no API! lobste.rs has a [web-based search](https://lobste.rs/search) but no equivalent mechanism via the JSON API I was using for doing everything else within the app.
While trying to implement post search functionality in [Claw](https://msfjarvis.dev/g/compose-lobsters), my [lobste.rs](https://lobste.rs) client I stumbled into a _tiny_ problem: there was no API! lobste.rs has a [web-based search](https://lobste.rs/search) but no equivalent mechanism via the JSON API I was using for doing everything else within the app.
The search page uses URL query parameters to specify the search term which made it quite easy to reliably construct a URL which would contain the posts we were interested in, and it looked something like this: `/search?q={query}&what=stories&order=newest&page={page}`.
Retrofit has a [Converter](https://github.com/square/retrofit/blob/40c4326e2c608a07d2709bfe9544cb1d12850d11/retrofit/src/main/java/retrofit2/Converter.java) API which lets users convert request/response bodies to and from their HTTP representations. We will leverage this to convert the raw HTML body we will receive from the search page into a list of LobstersPost objects.
Retrofit has a [Converter](https://github.com/square/retrofit/blob/40c4326e2c608a07d2709bfe9544cb1d12850d11/retrofit/src/main/java/retrofit2/Converter.java) API which lets users convert request/response bodies to and from their HTTP representations. We will leverage this to convert the raw HTML body we will receive from the search page into a list of LobstersPost objects.

View File

@ -38,11 +38,11 @@ export default async (request: Request, context: Context) => {
return redirect(`${GITHUB_URL}/${APS_SLUG}/${urlParts[1]}`);
case 3:
return redirect(
`${GITHUB_URL}/${APS_SLUG}/${urlParts[1]}/commit/${urlParts[2]}`
`${GITHUB_URL}/${APS_SLUG}/${urlParts[1]}/commit/${urlParts[2]}`,
);
case 4:
return redirect(
`${GITHUB_URL}/${APS_SLUG}/${urlParts[1]}/issues/${urlParts[3]}`
`${GITHUB_URL}/${APS_SLUG}/${urlParts[1]}/issues/${urlParts[3]}`,
);
}
default:

View File

@ -11,7 +11,7 @@ export default async (request: Request, context: Context) => {
},
{
status: Status.BadRequest,
}
},
);
} else if (resourceParam !== "acct:harsh@msfjarvis.dev") {
return context.json(
@ -20,7 +20,7 @@ export default async (request: Request, context: Context) => {
},
{
status: Status.BadRequest,
}
},
);
} else {
return context.json({