Skip to content

Instantly share code, notes, and snippets.

View omerkoseoglu's full-sized avatar
🚩
Working

Ömer KÖSEOĞLU omerkoseoglu

🚩
Working
View GitHub Profile
@omerkoseoglu
omerkoseoglu / precommit
Created March 10, 2023 19:55
Laravel git precommit hook
#!/bin/sh
spin='-\|/'
i=0
STAGED_FILES=$(git diff --name-only --diff-filter=ACM | grep ".php\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
@omerkoseoglu
omerkoseoglu / sql-one-or-all.sql
Created December 29, 2021 17:34
İşlem bir satırda mı yoksa tüm satırlarda mı çalışsın?
--CREATE TABLE Customers (
-- Id INT IDENTITY(1,1) PRIMARY KEY,
-- CustomerName VARCHAR(50) NOT NULL
--)
--GO
--INSERT INTO Customers(CustomerName)
--VALUES ('Apple'), ('Microsoft'), ('Oracle'), ('IBM'), ('Dell')
/*
@omerkoseoglu
omerkoseoglu / group-concat-installation-script.sql
Created December 23, 2021 10:57
GROUP_CONCAT string aggregate for SQL Server
/*
GROUP_CONCAT string aggregate for SQL Server - https://groupconcat.codeplex.com
Copyright (C) 2011 Orlando Colamatteo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
@omerkoseoglu
omerkoseoglu / EloquentCheatSheet.md
Created May 28, 2021 17:31 — forked from avataru/EloquentCheatSheet.md
Eloquent relationships cheat sheet
@omerkoseoglu
omerkoseoglu / pgloader
Created December 23, 2020 12:43
pgloader
pgloader mysql://user:pass@host/mysqldatabasename postgresql://user@host/pgdatabasename
@omerkoseoglu
omerkoseoglu / docker-mysql.txt
Created October 26, 2020 19:20
Docker Mysql Native Password
docker run --restart always --name mysql8.0 --net dev-network -v /Users/omer/Docker/mysql/data/8.0:/var/lib/mysql -p 3306:3306 -d -e MYSQL_ROOT_PASSWORD=xxxxxxxx mysql:8.0 --default-authentication-plugin=mysql_native_password
@omerkoseoglu
omerkoseoglu / Dockerfile
Created October 19, 2020 07:58
nginx basic auth
FROM nginx:alpine
RUN apk add --no-cache apache2-utils
RUN htpasswd -c -b /etc/nginx/.htpasswd exampleuser 123456
COPY default.conf /etc/nginx/conf.d/default.conf
@omerkoseoglu
omerkoseoglu / create_exchanges_table.sql
Last active October 3, 2020 23:33
PostgreSQL Merkez Bankası Döviz Kurları Stored Procedure
-- auto-generated definition
create table exchanges
(
id uuid default uuid_generate_v4() not null
constraint exchanges_pk
primary key,
currency_id uuid
constraint exchanges_currencies_id_fk
references currencies
on delete restrict,
@omerkoseoglu
omerkoseoglu / postgresql-docker-plpython.txt
Last active November 4, 2020 18:50
Postgresql 12.4 docker
docker run --name postgres -e POSTGRES_PASSWORD=1234567 -d -p 5432:5432 -v /Users/omer/postgresql/data:/var/lib/postgresql/data -e PGDATA=/var/lib/postgresql/data/pgdata postgres:12.4
docker exec -it postgres /bin/sh
apt-get update
apt-get -y install python3 postgresql-plpython3-12
create extension "uuid-ossp";
select uuid_generate_v4();