Skip to content

Instantly share code, notes, and snippets.

View gokhangirgin's full-sized avatar
🌴
On vacation

Gökhan Girgin gokhangirgin

🌴
On vacation
View GitHub Profile
@gokhangirgin
gokhangirgin / Parent_Child_CTE_SQL_Server.sql
Last active July 2, 2019 08:57
Parent Child CTE SQL Server
CREATE TABLE #Organization(Id INT, ParentID INT, Name nvarchar(20));
INSERT INTO #Organization VALUES(1,NULL,'A');
INSERT INTO #Organization VALUES(2,NULL,'B');
INSERT INTO #Organization VALUES(3,NULL,'C');
INSERT INTO #Organization VALUES(4,1,'A->D');
INSERT INTO #Organization VALUES(5,2,'B->E');
INSERT INTO #Organization VALUES(6,3,'C->F');
@gokhangirgin
gokhangirgin / credit-card-expiry-date-regex-validator.html
Last active August 26, 2020 13:06
Credit Card Expiry Date Regex Validator
<!--
Allow these formats
- m/YY
- mm/YY
- m/YYYY
- mm/YYYY
- month 1-12
- year > 14 && year < 2099
http://jsfiddle.net/GhxKx/4/
@gokhangirgin
gokhangirgin / CLI
Created August 7, 2015 06:42
WinSCP deployment TeamCity with SSH
> WinSCP.com /script=%system.teamcity.build.workingDir%\deploy.dev /log=%system.teamcity.build.workingDir%\deploy.dev.log /parameter "private_key.ppk" "%system.teamcity.build.workingDir%" "/var/www/dev" "hostkey fingerprint"
@gokhangirgin
gokhangirgin / Client.java
Last active April 26, 2018 11:42
OKHttp TLS 1.2 Android
public static OkHttpClient getTLSClient(){
OkHttpClient myOkHttpClient = new OkHttpClient();
if(TLS_1_2){
//tls 1.2
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_2)
.build();
myOkHttpClient.setConnectionSpecs(Collections.singletonList(spec));
@gokhangirgin
gokhangirgin / definition.md
Last active July 11, 2016 21:43
Creates subset of geo points (near or far) from index (Elasticsearch)
@gokhangirgin
gokhangirgin / Elasticsearch.ex
Created March 18, 2017 13:37
Elasticsearch simple Elixir wrapper
defmodule MyApp.Elasticsearch do
use HTTPoison.Base
@es_config Application.get_env(:myapp, :elasticsearch)
def process_url(url) do
"#{@es_config[:url]}/#{@es_config[:type]}#{url}"
end
defp process_request_headers(headers) when is_map(headers) do
@gokhangirgin
gokhangirgin / pg_dump.ex
Created March 18, 2017 13:41
GenServer pg_dump
defmodule MyApp.PgDump do
use GenServer
require Logger
@backup_config Application.get_env(:myapp, :db_backup_config)
def start_link do
GenServer.start_link(__MODULE__, [], name: :pg_dump)
end
defp schedule_database_backup() do
import java.util.*;
public class Main {
private static Stack<Integer> StackMachine = new Stack<>();
private static HashSet<Character> Operators = new HashSet<>(Arrays.asList(new Character[] {'+', '-', '*', '/'}));
public static void main(String[] args) {
String input = "13+62*7+*";
/***
@gokhangirgin
gokhangirgin / Self Signed Certficate with PKCS12 and OpenSSH Public Key.md
Last active July 15, 2020 19:50
Self Signed Certficate with PKCS12 and OpenSSH Public Key

Step 1:

openssl req -x509 -sha256 -nodes -days 7300 -newkey rsa:2048 -keyout Sample.key -out Sample.pem

Step 2:

openssl pkcs12 -export -out Sample.p12 -inkey Sample.key -in Sample.pem

Step 3: