Skip to content

Instantly share code, notes, and snippets.

View brunocarvalhodearaujo's full-sized avatar

Bruno Carvalho de Araujo brunocarvalhodearaujo

View GitHub Profile
@brunocarvalhodearaujo
brunocarvalhodearaujo / proxmox_lxc_nfs_server.md
Created April 12, 2024 19:49 — forked from rwenz3l/proxmox_lxc_nfs_server.md
Install a NFS Server inside a LXC Container on Proxmox 5.1

Installing NFS inside LXC Container on Proxmox 5.1

Host Setup:

Create LXC Container as usual, but do not start it yet.

# Install NFS-Kernel on Host
apt install nfs-kernel-server
@brunocarvalhodearaujo
brunocarvalhodearaujo / pre-commit
Last active January 20, 2024 14:16 — forked from zioproto/pre-commit
Git hook to avoid committing a decrypted ansible vault
#!/bin/bash
git show :group_vars/all.yml | grep ^'$ANSIBLE_VAULT'
export encrypted=$?
if [ $encrypted -ne 0 ]; then
echo Ansible Vault not encrypted, refusing to commit
exit 1
fi
0 0 * * * root docker rm $(docker ps -a -q) && docker rmi $(docker images -q -f dangling=true)
0 0 * * * root docker volume ls -qf dangling=true | xargs -r docker volume rm
0 0 * * * root docker system prune -a -f
0 0 * * * root docker builder prune --all --force --verbose
const { makeRemoteExecutableSchema, introspectSchema, mergeSchemas } = require('graphql-tools')
const { createHttpLink } = require('apollo-link-http')
const { setContext } = require('apollo-link-context')
const { ApolloServer } = require('apollo-server-express')
const fetch = require('node-fetch')
const log4js = require('log4js')
const logger = log4js.getLogger('server.js')
logger.level = process.env.LOG_LEVEL || 'debug'
const express = require('express')
const categories = useMemo(() => {
return products.reduce((categories, { category }) => {
return !category || categories.find(({ id }) => category && category.id === id)
? categories
: [
...categories,
{
id: category.id,
value: category.id,
label: category.title,
@brunocarvalhodearaujo
brunocarvalhodearaujo / dd-tracing-logging-examples-nodejs.js
Created February 3, 2022 22:01 — forked from stevenc81/dd-tracing-logging-examples-nodejs.js
A quick example for Datadog APM tracing and logging
require('dd-trace').init({
hostname: process.env.DD_AGENT_HOST,
port: 8126,
env: 'development',
logInjection: true,
analytics: true,
});
const { createLogger, format, transports } = require('winston');
const addAppNameFormat = format(info => {
@brunocarvalhodearaujo
brunocarvalhodearaujo / postgres_queries_and_commands.sql
Created September 13, 2021 00:38 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@brunocarvalhodearaujo
brunocarvalhodearaujo / database.rules.json
Created September 2, 2021 05:10 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@brunocarvalhodearaujo
brunocarvalhodearaujo / gist:b1ffcd33f4128015fda67bd89b010d0e
Created September 2, 2021 03:58 — forked from katowulf/gist:4741111
Firebase security rules for a simple chat room model
{
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by auth.id) must be in $key/users
@brunocarvalhodearaujo
brunocarvalhodearaujo / release.yml
Last active August 10, 2021 04:28
build android and iOS release on expo
name: Expo Publish
on:
push:
tags:
- 'v*'
jobs:
build:
name: Install and publish