Skip to content

Instantly share code, notes, and snippets.

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

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / delete-by-query.json
Created September 4, 2018 12:57
Delete documents by query in Elasticsearch
POST INDEX_NAME/_delete_by_query
{
"query": {
"bool": {
"must": [
{
"term": {
"field1": "100"
}
},
@baybatu
baybatu / disable-vino-encryption.sh
Created August 13, 2018 06:37
Disable vino encryption on Ubuntu
gsettings set org.gnome.Vino require-encryption false
@baybatu
baybatu / update-rows-using-subquery.sql
Last active August 9, 2018 10:41
Update rows using sub select query in PostgreSQL
UPDATE cars
SET model = subNewCarsTable.newModelName
FROM (SELECT
nc.id AS carId,
nc.model AS newModelName
FROM new_cars nc
WHERE year=2018) subNewCarsTable
WHERE subNewCarsTable.carId = cars.id;
@baybatu
baybatu / elasticsearch-adjust-max-result-window.sh
Last active August 8, 2018 13:56
Adjust max_result_window property of index in Elasticsearch 6
# tested on Elasticseach 6.0.0
curl -XPUT "http://es-host:9200/my_index/_settings" -H 'Content-Type:application/json' -d '{ "index" : { "max_result_window" : 1000000 } }'
@baybatu
baybatu / adjust-fileupload-size-ingress.yml
Last active August 7, 2018 19:14
Adjust ingress fileupload size
# tested on kubernetes 1.10.5
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
# "0" for unlimited fileupload size
nginx.org/client-max-body-size: "100m"
name: myproject-gateway-ingress
@baybatu
baybatu / adjust-timeouts-ingress.yml
Created August 6, 2018 11:55
Adjust ingress connect and read timeouts
# tested on kubernetes 1.10.5
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "750"
nginx.ingress.kubernetes.io/proxy-read-timeout": "600"
name: my-project-gateway-ingress
@baybatu
baybatu / adjust-payload-size-ingress.yml
Last active August 7, 2018 19:13
Adjust ingress payload size
# tested on kubernetes 1.10.5
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-body-size": "100m"
name: myproject-gateway-ingress
@baybatu
baybatu / untrack-file-on-git-already-pushed-to-remote.md
Created June 20, 2018 14:43
Untrack file on git already pushed to remote
@baybatu
baybatu / next-execution-date-for-spring-cron-expressions.md
Last active March 14, 2021 04:18
Get next execution date for Spring cron expressions

I usually use Groovy Console to run code below to get next execution date for Spring cron expressions.

new org.springframework.scheduling.support.CronSequenceGenerator("0 0/5 * * * *").next(new Date())
@baybatu
baybatu / mockito-deep-stubs.md
Last active September 21, 2020 07:48
Mockito deep stubs for nested objects
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private NestedObject nestedObject;

example usage in a test method:

when(nestedObject.getStatusInfo().getValue().getStatus()).thenReturn(1);