Skip to content

Instantly share code, notes, and snippets.

Working from home

Batuhan Bayrakci baybatu

Working from home
View GitHub Profile
ufuk /
Created December 6, 2022 14:12
Display a Java process' system properties or flags (
# list Java processes
jcmd -l
# list running JVM's system properties or flags (select a 'pid' from above command's result list)
jcmd pid VM.system_properties
jcmd pid VM.flags
kubectl rollout restart deployment name-of-my-deployment
ufuk /
Created April 22, 2022 12:55
How to force k8s to delete a pod via kubectl?
kubectl delete pods your-pod-name --grace-period=0 --force -n your-namespace-name
ufuk / logback-spring.xml
Last active January 5, 2021 09:50
Spring Boot & AWS Elastic Beanstalk & AWS Cloudwatch Log Stream friendly logging with newline replacing support to convert root cause's stack trace into single line message. And does these within Spring Boot's default pattern layout.
View logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<appender name="CLOUD_WATCH_FRIENDLY" class="ch.qos.logback.core.ConsoleAppender">
<pattern>%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m %replace(%rEx{short}){'[\r\n\t]+', '\\n'}%nopex%n</pattern>
ufuk /
Last active November 13, 2020 07:43
How to initialize an instance of the constraint annotation while writing unit tests for a javax.validation.ConstraintValidator
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
@Constraint(validatedBy = ExampleConstraintValidator.class)
public @interface ExampleConstraint {
keburak / netscaler-pentest-add-header-sample.txt
Created September 17, 2020 13:59
netscaler Strict-Transport-Security , X-Frame-Options , X-Xss-Protection , CORS policy
View netscaler-pentest-add-header-sample.txt
#add x-frame-options header
add rewrite action act_insert_XFrame_header insert_http_header X-Frame-Options "\"SAMEORIGIN\""
add rewrite policy pol_enforce_XFrame TRUE act_insert_XFrame_header
#add HSTS header
add rewrite action act_insert_HSTS_header insert_http_header Strict-Transport-Security "\"max-age=157680000; includeSubDomains; preload\""
add rewrite policy pol_enforce_HSTS TRUE act_insert_HSTS_header
#add x-xss-protection header
JonasGroeger /
Last active October 20, 2022 21:03
Spring Cron Expression Tester (Junit 5)
package de.jonasgroeger;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.time.ZoneId;
class SpringCronExpressionTester {
ufuk / import-csv-file-from-s3-into-aws-redshift.sql
Created January 31, 2019 14:01
Import CSV file from S3 into AWS Redshift
View import-csv-file-from-s3-into-aws-redshift.sql
-- Before importing, you need to create table
CREATE TABLE example_table
-- Importing...
COPY example_table
FROM 's3://<BUCKET_NAME>/.../example_table.csv'
CREDENTIALS 'aws_access_key_id=...;aws_secret_access_key=...'
ufuk /
Created January 31, 2019 13:55
Echo time by timezone in BASH
echo "$(TZ='Europe/Moscow' date +%Y-%m-%d\ %H\:%M)"
# output => 2019-01-31 16:52
dettmering /
Created January 30, 2019 08:12
BitBar plugin for showing host availability
import os
hosts = [
header = []