Skip to content

Instantly share code, notes, and snippets.

Avatar

Emre Kağan Akkaya emrekgn

View GitHub Profile
@emrekgn
emrekgn / RepoSourcesListParser.java
Last active Dec 1, 2015
sources.list URL Parser - Prints out packages defined by repository URL
View RepoSourcesListParser.java
package tr.org.sources.list.parser;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
@emrekgn
emrekgn / checkstyle.xml
Created Feb 22, 2016
Checkstyle configuration for Google coding conventions
View checkstyle.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Source = https://github.com/checkstyle/checkstyle/tree/master/src/main/resources
Checkstyle configurartion that checks the Google coding conventions from:
- Google Java Style
@emrekgn
emrekgn / AhenkPlugin.cs
Last active Nov 4, 2016
Sample Implementation for Ahenk pGina Plugin
View AhenkPlugin.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using pGina.Shared.Types;
using log4net;
/*
* See https://github.com/pgina/pgina/wiki/Plugin-Tutorial
View blueprint-gist.md

blueprint.xml

The possible reference :

blueprintBundle Provides bundle's Bundle object.

@emrekgn
emrekgn / ELK-kurulumu.md
Created Aug 25, 2017
Debian tabanlı sistemlerde Elasticsearch, Logstash, Kibana kurulumu
View ELK-kurulumu.md

ELK (Elasticsearch, Logstash, Kibana) Kurulumu

Bu kılavuz Debian tabanlı Linux sistemlerde (Debian, Ubuntu, Mint, Pardus gibi) Filebeat ile birlikte ELK (Elasticsearch, Logstash, Kibana) kurulumunu anlatır.

  1. Kurulum yapılacak sistemde Java sürümü 8 veya üstü olmalıdır. java -version komutu ile sürüm kontrol edilebilir.
  2. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - komutuylaa Elastic APT deposunun anahtarını sisteme tanımlamak için çalıştırılır.
  3. echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list komutu ile Elastic APT deposu sisteme eklenir.
  4. sudo apt-get update && sudo apt-get install -y elasticsearch logstash kibana filebeat komutu ile Elasticsearch, Logstach, Kibana bileşenleri ve Filebeat ajan yazılımı kurulur.
  5. /etc/filebeat/filebeat.yml dosyası dilediğiniz bir metin editörü yardımıyla (sudo olarak!) açılarak Elasticsearch'e ait olan alanlar silinmeli ya d
View when-to-use-jta-xa.md

When to use?

JTA/XA is a kind of system insurance against data corruption (and the resulting business losses). The most common use cases are: Processing JMS messages from a queue and inserting the results in a database: you don't want a crash to lose messages whose results are not yet stored in the database. Updating two or more legacy back-end systems in the same transaction In general, whenever you access more than one back-end system in the same transaction the use of JTA/XA is highly recommended. Otherwise, the risk of data loss or corruption is too high (and not necessarily visible!). Many programmers try to avoid the "overhead" of JTA/XA by programming application-specific recovery code (such as trying to handle duplicate requests, storing extra state in the database, etc). However, all these approaches are brittle (not reusable, application-specific, and hard to test). In the end, the perceived overhead of JTA/XA is often replaced by equivalent but buggy overhead at the application level.

A sample

@emrekgn
emrekgn / list-users.ps1
Last active Oct 9, 2017
Powershell Tricks - List Users with groups, home directory and disabled status
View list-users.ps1
#
# Prints user name, groups, home directory and disabled status
#
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
$adsi.Children | where { $_.SchemaClassName -eq 'user' } | Foreach-Object {
$groups = $_.Groups() | Foreach-Object {
$_.GetType().InvokeMember('Name', 'GetProperty', $null, $_, $null)
}
$user = Get-WmiObject Win32_UserAccount -filter "LocalAccount=True AND Name='$($_.Name)'"
@emrekgn
emrekgn / latex-tr.md
Created Nov 30, 2018
LATEX Türkçe karakterler
View latex-tr.md
  • \u{g} – ğ
  • \u{G} – Ğ
  • \c{c} – ç
  • \c{C} – Ç
  • \c{s} – ş
  • \c{S} – Ş
  • \”{u} – ü
  • \”{U} – Ü
  • \”{o} – ö
  • \”{O} – Ö
@emrekgn
emrekgn / DummyController.java
Created Feb 14, 2018
DataTables - Spring Boot pagination example
View DummyController.java
package com.dummy.datatables.example;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
View jdk8-kurulum.md

Java 8 kurulumu

Debian tabanlı (Debian, Ubuntu, Mint, Pardus gibi) Linux sistemlerde (paket deposunda bulunmadığı taktirde) JDK8 aşağıdaki adımlar izlenerek kurulabilir:

  1. sudo apt-get install software-properties-common komutu ile (eğer yoksa) add-apt-repository komutuna ilişkin kurulum yapılır.
  2. sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" komutuyla Java 8'in bulunduğu paket deposu sisteme eklenir.
  3. sudo apt-get update && sudo apt-get install oracle-java8-installer komutuyla Oracle JDK 8 kurulumu tamamlanır.
  4. Kurulumu sınamak adına java -version komutu çalıştırılarak sürümün doğruluğu kontrol edilebilir.

Java kurulumlarının yönetimi