Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / next-execution-date-for-spring-cron-expressions.md
Last active Mar 14, 2021
Get next execution date for Spring cron expressions
View next-execution-date-for-spring-cron-expressions.md

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 / flink-classnotfoundexception-fix.md
Last active Mar 11, 2021
Flink fix of java.lang.ClassNotFoundException: org.apache.flink.api.scala.typeutils.CaseClassTypeInfo
View flink-classnotfoundexception-fix.md
@baybatu
baybatu / split-into-subarrays.js
Last active Mar 11, 2021
Splitting array into list of subarrays in javascript
View split-into-subarrays.js
/*
* Splits array into subarrays.
* count parameter indicates that how many item per subarray contains.
* Example usage: splitIntoSubArray([1,2,3,4,5], 2) -> [[1, 2], [3, 4], [5]]
*/
function splitIntoSubArray(arr, count) {
var newArray = [];
while (arr.length > 0) {
newArray.push(arr.splice(0, count));
}
@baybatu
baybatu / attach-listener-to-push-method.js
Last active Mar 5, 2021
Attach event listener to Array push method call
View attach-listener-to-push-method.js
var eventify = function(arr, callback) {
arr.push = function(e) {
Array.prototype.push.call(arr, e);
callback(arr);
};
};
var array = [1,2,3];
eventify(array, function(newArray) {
@baybatu
baybatu / logback-graylog-spark-integration.md
Last active Feb 24, 2021
Logback - Graylog (GELF) integration on Apache Spark
View logback-graylog-spark-integration.md

Assuming SPARK_HOME=/spark246

  • Put logback.xml into $SPARK_HOME/conf
  • Create additionaljars directory under $SPARK_HOME
  • Download required logback and logback-gelf related jars into additionaljars directory
    • log4j-over-slf4j-1.7.30.jar
    • logback-core-1.2.3.jar
    • logback-classic-1.2.3.jar
    • logback-gelf-2.2.0.jar
  • Tell Spark to use custom jar folder additionaljars as primarily classpath folder using following spark-submit parameters:
@baybatu
baybatu / cocoapods-publish-commands.md
Last active Jan 29, 2021
cocoapods pod publish commands
View cocoapods-publish-commands.md
git tag VERSION
git push origin tag VERSION
pod trunk push
@baybatu
baybatu / sound-restart.sh
Created Jan 14, 2021
restart sound nanesi on macos
View sound-restart.sh
#!/bin/bash
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' | awk '{print $1}'
@baybatu
baybatu / datagrip-database-connections.md
Last active Dec 28, 2020
Import & Export database connection properties in DataGrip
View datagrip-database-connections.md

on macOS

default folder in /Users/USERNAME/Library/Preferences/DataGrip2018.1/projects contains database connection properties.

DataGrip2018.1 states your DataGrip version

@baybatu
baybatu / log4j2-logstash-flink-configuration.md
Last active Dec 25, 2020
log4j2 example logstash configuration for flink 1.11
View log4j2-logstash-flink-configuration.md
@baybatu
baybatu / mjml-responsive-mails.md
Created Dec 25, 2020
MJML : Markup language for responsive mails
View mjml-responsive-mails.md