Skip to content

Instantly share code, notes, and snippets.

View kad1r's full-sized avatar

Kadir Avcı kad1r

View GitHub Profile
@kad1r
kad1r / get_fk_and_indexes_with_postgres.sql
Created November 16, 2023 14:58
Get FK and Indexes with PostgreSQL
select * from pg_indexes where tablename='your_table_name';
select tc.table_schema, tc.constraint_name, tc.table_name, kcu.column_name,ccu.table_schema as foreign_table_schema,ccu.table_name as foreign_table_name,ccu.column_name as foreign_column_name
from information_schema.table_constraints as tc
join information_schema.key_column_usage as kcu on tc.constraint_name = kcu.constraint_name and tc.table_schema = kcu.table_schema
join information_schema.constraint_column_usage as ccu on ccu.constraint_name = tc.constraint_name
where tc.constraint_type = 'foreign key' and tc.table_schema='your_db_schema' and tc.table_name='your_table_name';
@kad1r
kad1r / git_commands.md
Last active November 7, 2023 14:42
Git commands

Stash

git stash
git stash save "your_stash_name"
git stash list
// Remove nth stash
git stash pop stash@{n}
// Apply nth stash
git stash apply stash@{n}
// If stash apply give an error like error: unknown switch `e' then use with quote
@kad1r
kad1r / aws_configure.md
Created October 18, 2023 11:36
AWS Configure

AWS Configure

Open powershell and type aws configure

aws configure
enter access key
enter secret key
enter region
enter output format
@kad1r
kad1r / podman_helper.md
Last active October 12, 2023 09:46
Podman

https://dev.to/pr0pm/run-postgresql-pgadmin-in-pods-using-podman-386o

podman pod create --name postgres_pgadmin -p 9876:80
podman run --pod=postgres_pgadmin -e 'PGADMIN_DEFAULT_EMAIL=admin@admin.com' -e 'PGADMIN_DEFAULT_PASSWORD=yourpasswrod' --name pgadmin -d dpage/pgadmin4
podman run --pod=postgres_pgadmin -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user --name db -d postgres
podman pod stats postgres_pgadmin
** 0.0.0.0:9876 or 127.0.0.1:9876 copy/paste this to your browser to configure pgadmin

podman pod pause postgres_pgadmin
@kad1r
kad1r / postgres_conversion_example.sql
Created October 2, 2023 13:48
Postgres string to bigint conversion example by USING column_name:bigint
ALTER TABLE the_table ALTER COLUMN col_name TYPE integer USING (col_name::integer);
@kad1r
kad1r / .editorconfig
Created September 11, 2023 14:43 — forked from m-jovanovic/.editorconfig
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
@kad1r
kad1r / shrink_docker_size.md
Created March 28, 2023 11:30
Shrink docker size

Here is the original link

Go to ~\AppData\Local\Docker\wsl\data and check the file size of ext4.vhdx. Right click the file and select "Copy as path". Apply these commands on cmd.

wsl --shutdown
diskpart

New cmd will open and

@kad1r
kad1r / free-database-hosting.md
Created November 10, 2022 10:02 — forked from bmaupin/free-database-hosting.md
Free database hosting
@kad1r
kad1r / npm_updates.md
Created September 28, 2022 08:02
Check npm packages if needed updates

npm outdated
npm update --save