Skip to content

Instantly share code, notes, and snippets.

View ricardopadua's full-sized avatar
🎯
Focusing

Ricardo Pádua ricardopadua

🎯
Focusing
View GitHub Profile
@ricardopadua
ricardopadua / observer.md
Last active September 27, 2023 15:24
Debugging Elixir

Debugging - In this lesson we'll learn about debugging Elixir code as well as static analysis tools to help find potential bugs

IEx

The most straightforward tool we have for debugging Elixir code is IEx.

But don't be fooled by its simplicity - you can solve most of the issues with your application by it.

IEx means Elixir's interactive shell.

@ricardopadua
ricardopadua / github_desktop_ubuntu.sh
Created August 28, 2023 16:32 — forked from berkorbay/github_desktop_ubuntu.md
To install Github Desktop for Ubuntu
## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest
# UPDATE (2022-11-07): Thanks to Sxvxgee's message, the updated code is as follows
sudo wget https://github.com/shiftkey/desktop/releases/download/release-3.1.1-linux1/GitHubDesktop-linux-3.1.1-linux1.deb
### Uncomment below line if you have not installed gdebi-core before
# sudo apt-get install gdebi-core
sudo gdebi GitHubDesktop-linux-3.1.1-linux1.deb
# UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows
@ricardopadua
ricardopadua / wxWidgetInstall.md
Created June 7, 2023 22:43 — forked from pemd-sys/wxWidgetInstall.md
Installing wxWidgets

Installing wxWidgets on Ubuntu

The latest download and install instructions are available in
https://docs.wxwidgets.org/3.1/plat_gtk_install.html
The wiki is a bit old so try following the above and consult the wiki for more details. BUT, follow the steps as per the docs NOT the wiki.
https://wiki.wxwidgets.org/Compiling_and_getting_started

However sometimes specially for new linux users it can become overwhelming and installation process can throw funny errors. So I have created a step by step process to hopefully help you compile wxwidgets. Enjoy :-)

Installing pre-requisites

@ricardopadua
ricardopadua / tmux.conf
Created May 30, 2023 22:31 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@ricardopadua
ricardopadua / stream_csv.ex
Last active May 4, 2023 11:20 — forked from tngan/stream_csv.ex
Streaming CSV straight out of the database to the client using Elixir, Phoenix, Ecto and PostgreSQL.
def index(conn, _params) do
conn = conn
|> put_resp_content_type("text/csv")
|> put_resp_header("content-disposition", "attachment; filename=export.csv")
|> send_chunked(200)
Repo.transaction fn ->
Ecto.Adapters.SQL.stream(Repo, "COPY expensive_report TO STDOUT CSV HEADER")
|> Stream.map(&(chunk(conn, &1.rows)))
|> Stream.run
@ricardopadua
ricardopadua / config
Last active August 26, 2022 15:55
sample configuration pgadmin4
AUTHENTICATION_SOURCES = ['oauth2']
OAUTH2_AUTO_CREATE_USER = True
OAUTH2_CONFIG = [{
'OAUTH2_NAME': 'github',
'OAUTH2_DISPLAY_NAME': 'Github',
'OAUTH2_CLIENT_ID': xxxxxxxxxx,
'OAUTH2_CLIENT_SECRET': xxxxxxxxxxxx,
'OAUTH2_TOKEN_URL': 'https://github.com/login/oauth/access_token',
'OAUTH2_AUTHORIZATION_URL': 'https://github.com/login/oauth/authorize',
'OAUTH2_API_BASE_URL': 'https://api.github.com/',
@ricardopadua
ricardopadua / netrw.txt
Created August 17, 2022 11:36 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@ricardopadua
ricardopadua / pipeline.ex
Last active July 21, 2022 00:28
pipeline Ecto Multi
@spec pipeline(any) :: (() -> any)
def pipeline(params) do
create_operation = fn (multi, params) ->
Ecto.Multi.run(multi, :create_operation, fn _, _ ->
Logger.info("create_operation")
{:ok, nil}
end)
end
verify_condition = fn (multi, params) ->
@ricardopadua
ricardopadua / docker-compose.yml
Last active March 19, 2022 16:25
alchemist-training
version: '3.8'
services:
livebook:
image: 'livebook/livebook:0.5.2'
container_name: livebook
restart: always
ports:
- '8080:8080'
networks:
- "prologic-net"
@ricardopadua
ricardopadua / config
Created March 1, 2022 01:51 — forked from pksunkara/config
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta