Skip to content

Instantly share code, notes, and snippets.

View entrofi's full-sized avatar
🧗‍♀️

Hasan Çomak entrofi

🧗‍♀️
View GitHub Profile
@entrofi
entrofi / PrimeNumberCollector.java
Last active August 22, 2017 15:52
Java 8 Simple Custom Collector Showcase
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import static java.util.stream.Collector.Characteristics.IDENTITY_FINISH;
@entrofi
entrofi / screenCheatSheet.md
Last active January 2, 2018 10:17
Screen Cheat Sheet

GNU Screen Cheat Sheet

Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dows
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
@entrofi
entrofi / GerritDockerFile
Created September 26, 2017 06:13
Simple Basic Ubuntu Based Gerrit Docker File
FROM ubuntu:16.04
LABEL "author"="Hasan Comak"
ENV GERRIT_VERSION="2.13.9"
ENV GERRIT_RELEASE=1
ENV GERRIT_HOME /var/gerrit
ENV GERRIT_SITE ${GERRIT_HOME}/review_site
@entrofi
entrofi / SonarQube-docker-compse.yml
Created September 28, 2017 20:01
Sonarqube Docker Compse Sample
version: "2"
services:
sonarqube:
image: sonarqube
ports:
- "9000:9000"
networks:
- sonarnet
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
@entrofi
entrofi / ExportDDL.java
Last active June 4, 2021 12:57
JPA Export DDL
@Bean(name = JPA_PROPERTIES_BEAN_NAME)
public Properties jpaPropertiesUnitTest() {
Properties properties = new Properties();
properties.put(PROPERTY_HIBERNATE_DIALECT, "org.hibernate.dialect.H2Dialect");
properties.put(PROPERTY_HIBERNATE_SHOW_SQL, true);
properties.put(PROPERTY_HIBERNATE_FROMAT_SQL, true);
properties.put(PROPERTY_HIBERNATE_DDL, VALUE_HIBERNATE_DDL_UPDATE);
properties.put(PROPERTY_HIBERNATE_NAMING_STRATEGY, VALUE_HIBERNATE_DEFAULT_NAMING_STRATEGY);
properties.put(PROPERTY_HIBERNATE_CONNECTION_CHARSET, DEFAULT_CHARSET);
@entrofi
entrofi / UnWelcomeGuest.java
Last active April 20, 2018 13:28
Java Puzzlers Un welcome guest
public class Loop {
public static void main(String[] args) {
int[][] tests = {{6, 5, 4, 3, 2, 1}, {1, 2},
{1, 2, 3}, {1, 2, 3, 4}, {1}};
int successCount = 0;
try {
int i = 0;
while (true) {
if (thirdElementIsThree(tests[i++]))
successCount++;
@entrofi
entrofi / Java8MethodReference.java
Created March 2, 2019 08:21
Java 8 Method References
List<SomeComparableObject> objects = Arrays.asList( o1, o2, o3, ...);
ojbects.sort((SomeComparableObject o1, SomeComparableObject o2) -> o1.compareTo(o2)); // or with method reference
objects.sort(SomeComparableObject::compareTo);
@entrofi
entrofi / Note.java
Created March 20, 2019 10:26
Rest Api Documentation with Rest Assured and Spring Boot
@Entity
public class Note {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private String details;
@entrofi
entrofi / Customized Mysql Docker Image
Last active April 5, 2019 10:15
Creating a Customized Mysql Docker Image Supported by Initialization Scripts
FROM mysql:8.0
LABEL description="My Custom Mysql Docker Image"
# Add a database
ENV MYSQL_DATABASE CARDS
#Check out docker entry point for further configuration :
# https://github.com/docker-library/mysql
COPY ./init-scripts/ /docker-entrypoint-initdb.d/
@entrofi
entrofi / tmux_cheatsheet.md
Last active July 9, 2024 06:26
tmux cheatsheet

Tmux CheatSheet

Session Management

tmux new -s session_name creates a new tmux session named session_name

tmux attach -t session_name attaches to an existing tmux session named session_name

tmux switch -t session_name switches to an existing session named session_name