Skip to content

Instantly share code, notes, and snippets.

View GregRos's full-sized avatar

Greg Ros GregRos

View GitHub Profile
@GregRos
GregRos / fastify.meta.ts
Last active August 26, 2023 14:42
Meta type system: Usage Examples
// Includes RawServer, RawReply, RawRequest
export type MRaw := <
Server extends RawServerBase = RawServerDefault
Request extends RequestDefault
Reply extends ReplyDefault
RequestDefault := (RawServer extends http.Server | http2.Server ? ...)
ReplyDefault := (RawServer extends ...)
>
// Updates the squggle by id
export async function updateSquggle(data) {
const owner = await getSquggleOwnerInfo(data.id)
if (owner.id !== USER) {
if (!owner.isTeam) {
throw new Error("Owner not a team")
}
const perms = await getUserTeamPermissions(owner.id)
if (!perms) {
throw new Error("User not member of team.")
// Updates the squggle by id
export async function updateSquggle(data) {
const owner = await getSquggleOwnerInfo(data.id)
if (owner.id !== USER) {
if (!owner.isTeam) {
throw new Error("Owner not a team")
}
const perms = await getUserTeamPermissions(owner.id)
if (!perms) {
throw new Error("User not member of team")
let USER = 1000;
// Logs user in using `auth`
export async function login(auth) { /* ... */ }
// Gets a list of all squmbles of the user
export async function getSqumbles() { /* ... */ }
// Gets squmble by ID
export async function getSqumble(id) { /* ... */ }
We couldn’t find that file to show.
// Updates the squggle by id
export async function updateSquggle(data) {
const owner = await getSquggleOwnerInfo(data.id)
if (owner.id !== USER) {
if (!owner.isTeam) {
throw new Error("Owner not a team")
}
const perms = await getUserTeamPermissions(owner.id)
if (!perms) {
throw new Error("User not member of team")
let USER = 1000;
// Logs user in using `auth`
export async function login(auth) { /* ... */ }
// Gets a list of all squmbles of the user
export async function getSqumbles() { /* ... */ }
// Gets squmble by ID
export async function getSqumble(id) { /* ... */ }
@GregRos
GregRos / manifest.json
Created June 14, 2022 22:42
Manifest.json including a list of all permissions on my platform, 2022-06-15
{
"name": "Getting Started Example",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"activeTab",
"alarms",
"background",
"bookmarks",
@GregRos
GregRos / more-about-pretty-and-usable-wsl-terminals.md
Last active May 3, 2021 15:58
Some notes on "Configuring a pretty and usable terminal emulator for WSL"

These comments are based on a few years of experience working with WSL. It's based on this tutorial:

https://blog.ropnop.com/configuring-a-pretty-and-usable-terminal-emulator-for-wsl/

And are basically updates to make it more relevant.

Opening a shell

In the past, to make the WSL run a command from cmd or somewhere else, you had to run the bash.exe program from windows, which fired up bash (and always bash) in the WSL and made it execute a command.

@GregRos
GregRos / startTerminator.vbs
Created April 27, 2019 00:20 — forked from ropnop/startTerminator.vbs
VBS Script to Launch Terminator through WSL
' terminator.vbs
myCd = "~"
If WScript.Arguments.Length > 0 Then
myCd = "'$(wslpath -u '" & WScript.Arguments(0) & "')'"
End If
args = "bash" & " -c ""cd " & myCd & "; DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "C:\Windows\System32\wsl.exe", args, "", "open", 0