Skip to content

Instantly share code, notes, and snippets.

View cenkc's full-sized avatar
🏠
Working from home

Cenk Canarslan cenkc

🏠
Working from home
View GitHub Profile
@cenkc
cenkc / CustomBeanRegistrar.java
Created March 15, 2021 00:37
registering Spring beans manually at runtime
package com.cenkc.app.service;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.stereotype.Service;
/**
* created by Cenk Canarslan on 2021-03-15
************** Client java **************
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("redis-conf.yaml");
Config config = Config.fromYAML(is);
RedissonClient client = Redisson.create(config);
************** application.properties **************
************** application.properties **************
spring.redis.redisson.config=classpath:redis-conf.yaml
************** application.properties **************
************** redis-conf.yaml **************
---
Hackerrank - Data Structures by Gayle Laakman McDowell, author of the Cracking the Coding Interview
https://www.youtube.com/watch?v=IhJGJG-9Dx8&list=PLI1t_8YX-Apv-UiRlnZwqqrRT8D1RhriX
Cracking The Coding Interview solutions by Gayle Laakman McDowell
https://github.com/careercup/CtCI-6th-Edition/tree/master/Java
Hackerrank - Algorithms by Gayle Laakman McDowell, author of the Cracking the Coding Interview
https://www.youtube.com/watch?v=KEEKn7Me-ms&list=PLI1t_8YX-ApvMthLj56t1Rf-Buio5Y8KL
MIT 6.006 Introduction to Algorithms, Fall 2011
@cenkc
cenkc / github-template.txt
Created March 14, 2020 22:29
using a github branch/repo as a template
$ git clone -b BRANCH_NAME_ON_REPO_XX https://github.com/cenkc/REPO_XX
$ rm -dfr .git
$ git init
$ git add .
$ git commit -m "initial commit"
@cenkc
cenkc / jasypt.txt
Last active October 14, 2021 11:51
jasypt encrypt & decrypt
Burada Maven plug-in’i kullanılarak yapılışı anlatılacaktır. Diğer yöntemler ve detay bilgi için bkz.: http://www.jasypt.org/
pom.xml dosyasına aşağıdaki plugin eklenmelidir.
<plugin>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-maven-plugin</artifactId>
<version>3.0.3</version>
</plugin>
'someValueToEncrypt' hassas verisini 'SoMePass_' ile encrypt etmek için komut satırında aşağıdaki komut çalıştırılmalıdır:
@cenkc
cenkc / git-mergetool-config.txt
Last active February 25, 2020 13:17
git diff & merge tool config
-- Set path for diff & merge tool.
git config --global difftool.winmerge.path 'D:\devEnv\WinMerge-2.16.6\WinMergeU.exe'
git config --global mergetool.winmerge.path 'D:\devEnv\WinMerge-2.16.6\WinMergeU.exe'
-- you may want to add another tool with :
-- git config --global difftool.kdiff3.path 'PATH_TO_KDIFF_EXE'
-- git config --global mergetool.kdiff3.path 'PATH_TO_KDIFF_EXE'
-- Set default diff & merge tool.
git config --global diff.tool winmerge
1) go to https://get.docker.com/
2) download the "get-docker.sh" script as mentioned in the very first paragraph:
$ curl -fsSL https://get.docker.com -o get-docker.sh
3) then run the script:
$ sh get-docker.sh
4) If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like:
$ sudo usermod -aG docker cenkc
5) check if installation successful
$ sudo docker version
6) then go to https://docs.docker.com/machine/install-machine/ and install docker machine using command:
https://www.kauffmann.nl/2019/03/04/how-to-install-docker-on-windows-10-without-hyper-v/
@cenkc
cenkc / RestTemplateSamples.java
Created December 25, 2019 11:49
Spring RestTemplate usage
package com.cenkc.samples;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URISyntaxException;
import java.util.Arrays;
public class RestTemplateSamples {
@cenkc
cenkc / as-of-timestamp.sql
Created December 10, 2019 19:37
oracle flashback query
select * from some_tbl
AS OF TIMESTAMP TO_TIMESTAMP('2019-12-10 22:00:12', 'YYYY-MM-DD HH24:MI:SS');