Skip to content

Instantly share code, notes, and snippets.

View gmcabrita's full-sized avatar

Gonçalo Mendes Cabrita gmcabrita

View GitHub Profile
@gmcabrita
gmcabrita / waydroid.sh
Created November 3, 2023 09:28
waydroid weston
#!/bin/bash
if [ "$(systemctl is-active waydroid-container.service)" == 'active' ];then
killall -9 weston
sudo systemctl stop waydroid-container.service
exit
fi
killall -9 weston
sudo systemctl restart waydroid-container.service
if [ -z "$(pgrep weston)" ]; then
weston --xwayland &> /dev/null &
<!doctype html> <html ng-app="mwgApp" lang="en-US"> <head> <meta charset="utf-8"> <title ng-bind="title || 'McCann Worldgroup | Integrated Global Network of Specialty Marketing Agencies'">McCann Worldgroup | Integrated Global Network of Specialty Marketing Agencies</title> <base href="/"> <link rel="canonical" href="https://www.mccannworldgroup.com/"/> <meta name="description" content="{{description || 'McCann Worldgroup is a leading global marketing services company with an integrated network of advertising agencies in over 120 countries'}}"> <meta name="viewport" content="width=device-width"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta property="og:type" content="Website"/> <meta property="twitter:card" content="Summary"/> <meta property="og:title" content="McCann Worldgroup | Integrated Global Network of Specialty Marketing Agencies" /><meta property="twitter:title" content="McCann Worldgroup | Integrated Global Network of Specialty Marketing Agencies" /><meta property="og:url" content="htt
import { cursor } from "./cursor"
let progressValue: number = 0
let currentValue: number = 0
let timer: Timer | undefined = undefined
let maxLength: number = 0
let lastProgress: number = 0
let barChar: string = "▣"
let emptyChar: string = "⬚"
@gmcabrita
gmcabrita / fast-custom-credo-check.ex
Created September 17, 2023 18:12
fast custom credo check performance mix credo elixir — from https://twitter.com/sasajuric/status/1699324005105176687
# Slow
Credo.Code.prewalk(source, fn ... >
...
# may run really slow if there are many issues
format_issue(...)
end)
# Fast
# Run with:
# elixir generate_deps_changelogs.exs
#
# This is a quick script to generate changelogs on screen, comparing `mix.lock` on current branch vs `master`.
# It makes it easier to review changes provided by a given PR. Yes, dependabot exists,
# but does not support grouped updates (https://github.com/dependabot/dependabot-core/issues/1190)
# and does not work well on an existing PR.
#
# Already used in the past, and if useful on the long run, we'll create a GitHub action workflow to run
# and automatically edit the PR description with this.

Title

Descrition

Description of the situation.

Problem

Problem statement.

title publish_date draft tags
Self-hosting miniflux on Fly
2022-12-23
false

This week I deployed miniflux, a minimalist and opinionated feed reader, on Fly.

I'd been wanting to stop focusing on HN and Twitter as my biggest source for new reading material. Most content on HN is not what I would call curated. Even my Twitter timeline doesn't feel like it's worth scavenging for reading material.

Ruby exception inheritance

module Phlex
  Error = Module.new

  NameError = Class.new(NameError) { include Error }
  ArgumentError = Class.new(ArgumentError) { include Error }
  StandardError = Class.new(StandardError) { include Error }
end

Ruby jemalloc

Adding jemalloc via LD_PRELOAD

FROM ruby:3.2-slim

RUN apt-get update ; \\
    apt-get install -y --no-install-recommends
      libjemalloc2 ; \\

Ruby callable service object

module Callable
  def call
    raise NoMethodError
  end

  def to_proc
 method(:call).to_proc