Skip to content

Instantly share code, notes, and snippets.

View gustavomedeiross's full-sized avatar

Gustavo Medeiros gustavomedeiross

  • Bluecode
  • Florianópolis, Brazil
View GitHub Profile
@gustavomedeiross
gustavomedeiross / truncate_large_fields.sql
Created July 26, 2024 15:42
Truncate large JSONs in psql
CREATE OR REPLACE FUNCTION truncate_large_fields(
json_data jsonb,
max_length int DEFAULT 100
) RETURNS jsonb AS $$
DECLARE
key text;
value jsonb;
result jsonb := '{}';
BEGIN
FOR key, value IN SELECT * FROM jsonb_each(json_data)
@gustavomedeiross
gustavomedeiross / README.md
Created February 11, 2024 16:11
CS2 Config

Tutorial

Autoexec

Save autoexec in C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\core\cfg

Crosshair

Crosshair Code: CSGO-HRUtd-7NxSn-DxZ6w-M4OPW-wjA6Q

@gustavomedeiross
gustavomedeiross / hm_with_kinds.ml
Created August 17, 2023 01:55 — forked from mb64/hm_with_kinds.ml
Hindley-Milner type checking with higher-kinded types, in OCaml
type name = string
module AST = struct
type ty =
| TFun of ty * ty
| TNamed of string
| TApp of ty * ty
type exp =
| Annot of exp * ty
@gustavomedeiross
gustavomedeiross / diabetes.csv
Last active May 26, 2023 00:05
diabetes.ipynb
Gravidez Glicose PressaoArterial EspessuraPele Insulins IMC FunctionPedigree Idade Resultado
6 148 72 35 0 33.6 0.627 50 1
1 85 66 29 0 26.6 0.351 31 0
8 183 64 0 0 23.3 0.672 32 1
1 89 66 23 94 28.1 0.167 21 0
0 137 40 35 168 43.1 2.288 33 1
5 116 74 0 0 25.6 0.201 30 0
3 78 50 32 88 31 0.248 26 1
10 115 0 0 0 35.3 0.134 29 0
2 197 70 45 543 30.5 0.158 53 1
@gustavomedeiross
gustavomedeiross / Flexible Dockerized Phoenix Deployments.md
Created April 6, 2021 13:32 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@gustavomedeiross
gustavomedeiross / gist:9fb3eca90bf985c6c398292cb4dae9fc
Created January 26, 2021 23:35 — forked from nilo/gist:c2a31a0f9f29c88145ca
Using cedilha - ArchLinux Cinnamon
Author: Nilo Dantas - n1lo
Based on: https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/518056 - helio-valente post
How to use Cedilha on US Keyboard on ArchLinux
1) Put: English(US, internacional with dead Keys) on your system keyboard layout.
2) Editing the files:
sudo vim /usr/lib/gtk-3.0/3.0.0/immodules.cache
@gustavomedeiross
gustavomedeiross / create_post.exs
Created January 23, 2021 22:29 — forked from stevedomin/create_post.exs
Using UUIDs as primary key with Ecto
defmodule MyBlog.Repo.Migrations.CreatePost do
use Ecto.Migration
def change do
create table(:posts, primary_key: false) do
add :id, :uuid, primary_key: true
add :body, :string
add :word_count, :integer
timestamps
#!/bin/bash
#
# fix-cedilla
#
# This is a very simple program to configure your personal ".XCompose" file and
# your environment so that typing 'c will generate a cedilla c instead of an
# accented c.
#
# For further information, visit:
# http://github.com/marcopaganini/gnome-cedilla-fix
code --install-extension bierner.markdown-preview-github-styles
code --install-extension colinkaopu.d
code --install-extension Dart-Code.dart-code
code --install-extension Dart-Code.flutter
code --install-extension dbaeumer.vscode-eslint
code --install-extension EditorConfig.EditorConfig
code --install-extension esbenp.prettier-vscode
code --install-extension GraphQL.vscode-graphql
code --install-extension JakeBecker.elixir-ls
code --install-extension jdinhlife.gruvbox
shadow = true;
detect-rounded-corners = true;
shadow-radius = 5;
shadow-offset-x = 1;
shadow-offset-y = 1;
shadow-opacity = 0.3;
shadow-ignore-shaped = false;
shadow-exclude = [ "name = 'Notification'", "override_redirect = 1 && !WM_CLASS@:s", "class_g ?= 'Dmenu'", "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", "_GTK_FRAME_EXTENTS@:c", "class_g ?= 'i3-frame'", "class_g ?= 'trayer'" ];
inactive-opacity = 1.0;
active-opacity = 1;