Skip to content

Instantly share code, notes, and snippets.

View Godoy's full-sized avatar

Adriano Godoy Godoy

View GitHub Profile
@Godoy
Godoy / rails_mailer_smtp.md
Last active March 11, 2024 19:01
Config Ruby on Rails with SMTPs - dreamhost outlook

Settings for rails smtp

config/environments/development.rb

Set raise_delivery_errors true on development

  config.action_mailer.raise_delivery_errors = true 

IMPORTANT

@Godoy
Godoy / kcat.md
Last active September 14, 2023 17:07
Using kcat with jq to read a kafka topic message

Given a message like this:

{ "message": {"accountId":1,"timestamp":"1694709688878","amount":1001,"sentFromClientAt":1694709688913}, "delivered_at": 1694709688954 }

The kcat command can be used with jq to format message, even a calculated attribute:

kcat -C -b localhost:31090 -f '{ "message": %s, "delivered_at": %T } \n' -t input-topic -u | jq '. + { "took": "\(.delivered_at - .message.sentFromClientAt) ms" }'
@Godoy
Godoy / gist:9890991
Created March 31, 2014 12:13
script sql para alterar a collation de todas as colunas no banco de dados sql server - salvar como txt e rodar os scripts.
declare @NewCollationName sysname
set @NewCollationName = 'SQL_Latin1_General_CP1_CI_AI'
select
'ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(st.schema_id)) + '.' + QUOTENAME(st.name) +
' ALTER COLUMN ' + QUOTENAME(sc.name) + ' ' + styp.name + '(' +
CASE WHEN sc.max_length = -1 THEN 'max' ELSE CONVERT(varchar(10),sc.max_length) END +
') collate ' + @NewCollationName + '
go
'
from
@Godoy
Godoy / iterm.md
Last active February 23, 2023 17:22
ohmyzsh configurations and plugins
@Godoy
Godoy / keybindings.json
Last active March 22, 2021 18:31
toggle terminal on vs code
[
{
"key": "ctrl+alt+t",
"command": "workbench.action.closePanel",
"when": "terminalFocus"
},
{
"key": "ctrl+alt+t",
"command": "workbench.action.toggleMaximizedPanel",
"when": "!terminalFocus"
@Godoy
Godoy / gist:4538424
Last active June 16, 2020 17:44
Desfazendo coisas no Rails
$ rails generate controller Noticias titulo
$ rails destroy controller Noticias titulo
$ rails generate model Noticia titulo:string
$ rails destroy model Noticia
$ rake db:migrate
$ rake db:rollback
$ rake db:migrate VERSION=0 #defaz todas as migrations, deixa o banco "limpo"
@Godoy
Godoy / spark.py
Created February 3, 2019 16:28
python function to transform spark dataframe to pandas using limit
def pshow(sparkDf, limit=10):
return sparkDf.limit(limit).toPandas()
@Godoy
Godoy / gist:dc64bd8cab08929b292c
Last active April 5, 2018 17:43
Getting Started Kooboo CMS
  1. Clone o repositório: https://github.com/Kooboo/CMS.git
  2. Execute o arquivo CMS\Kooboo.CMS\Publish\publish.bat para que ele gere o projeto do website para o visual studio.
  3. O projeto estará na pasta CMS\Kooboo.CMS\Publish\Web. Copie todo o conteúdo desta pasta. Este será o seu projeto a partir de agora. Neste ponto já é possível rodar�, customizar o site, criar conteúdo. O CMS está pronto para ser utilizado, mas todo o conteúdo está sendo armazenado em XML. Precisamos trocar o provider.
  4. Para trocar o provider, descompacte o arquivo que se encontra em: CMS\Kooboo.CMS\Publish\Released\Content_Providers.zip. Para utilizar SQL Server, copie os arquivos da pasta SQLServer\Kooboo.CMS.Content.Persistence.SQLServer.dll e SQLServer\SqlServer.config para a pasta Wev\bin do seu projeto, gerado nos passos 1 e 2.
  5. Configure a connection string do arquivo SqlServer.config (veja mais em http://wiki.kooboo.com/?wiki=Setup_database_provider#SQLServer)
### Keybase proof
I hereby claim:
* I am godoy on github.
* I am agodoy (https://keybase.io/agodoy) on keybase.
* I have a public key ASCHj9JiLOg-r_EGv-cMa4ShYioCiFoF3Pd8pcahky6v_go
To claim this, I am signing this object:
@Godoy
Godoy / Steps.md
Last active June 20, 2017 21:38
deploy ruby on rails 4 with capistrano nginx unicorn - ubuntu 14.04

Steps

These steps were made with Ubuntu 14.04 e ruby 2.3.1. To enjoy the ease of step-by-step, I suggest not change folders and application name - just change the server ip and git

Create user to deploy

# Server console
sudo adduser deployer
sudo gpasswd -a deployer sudo