Skip to content

Instantly share code, notes, and snippets.

View gutocarvalho's full-sized avatar

Guto Carvalho gutocarvalho

View GitHub Profile
Facter.add(:postgresql) do
setcode do
confine :kernel => 'Linux'
postgresql = {}
distid = Facter.value(:osfamily)
case distid
when /RedHat|Suse/
postgresql_check = Facter::Core::Execution.exec('which postmaster')
when "Debian"
Facter.add(:dovecot) do
setcode do
confine :kernel => 'Linux'
dovecot = {}
distid = Facter.value(:osfamily)
case distid
when /RedHat|Suse/
dovecot_check = Facter::Core::Execution.exec('which dovecot')
when "Debian"

Keybase proof

I hereby claim:

  • I am gutocarvalho on github.
  • I am gutocarvalho (https://keybase.io/gutocarvalho) on keybase.
  • I have a public key ASCXIb68qDZ1K-3h1uerdGdPB2L5Sg25ZTtIopK8W8xcPQo

To claim this, I am signing this object:

2022-10-11T09:42:37.992-0300 [INFO] Terraform version: 1.3.2
2022-10-11T09:42:37.992-0300 [DEBUG] using github.com/hashicorp/go-tfe v1.9.0
2022-10-11T09:42:37.992-0300 [DEBUG] using github.com/hashicorp/hcl/v2 v2.14.1
2022-10-11T09:42:37.992-0300 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-10-11T09:42:37.992-0300 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-10-11T09:42:37.992-0300 [DEBUG] using github.com/zclconf/go-cty v1.11.0
2022-10-11T09:42:37.992-0300 [INFO] Go runtime version: go1.19.2
2022-10-11T09:42:37.992-0300 [INFO] CLI args: []string{"terraform", "validate"}
2022-10-11T09:42:37.992-0300 [DEBUG] Attempting to open CLI config file: /Users/gcarvalho/.terraformrc
2022-10-11T09:42:37.992-0300 [INFO] Loading CLI configuration from /Users/gcarvalho/.terraformrc
@gutocarvalho
gutocarvalho / docker-compose.yaml
Created December 11, 2022 14:17
mastodon docker-compose
version: '3'
services:
postgresql:
image: postgres:14
env_file: database.env
restart: always
shm_size: 256mb
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'mastodon']
#!/bin/bash
INSTANCE_URL="bolha.us/api/v1/instance"
echo "Getting the number of users from Mastodon..."
count=$(curl -s $INSTANCE_URL | jq '.stats.user_count')
echo "Number of users: $count"
#!/bin/bash
# Enter the name of the Mastodon instance you want to publish a toot to
INSTANCE="bolha.us"
# Enter the contents of the toot you want to publish
TOOT="e a noite vai virar dia..."
## Replace TOKEN with your Mastodon TOKEN
TOKEN="YOUR TOKEN"
@gutocarvalho
gutocarvalho / gist:7004f425073981639e4a4da12380720e
Created April 12, 2023 21:45
get mastodon stats using shell curl and jq
#!/bin/bash -
INSTANCE_ENDPOINT_V1="bolha.us/api/v1/instance"
INSTANCE_ENDPOINT_V2="bolha.us/api/v2/instance"
INSTANCE_URL="bolha.us"
COUNT_TOTAL_USERS=$(curl -s $INSTANCE_ENDPOINT_V1 | jq '.stats.user_count')
COUNT_ACTIVE_USERS=$(curl -s $INSTANCE_ENDPOINT_V2 | jq '.usage.users.active_month')
COUNT_POOL_LIMIT=$(curl -s $INSTANCE_ENDPOINT_V2 | jq '.configuration.polls.max_options')
COUNT_CHAR_LIMIT=$(curl -s $INSTANCE_ENDPOINT_V2 | jq '.configuration.statuses.max_characters')