Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / limit-number.py
Created Jun 26, 2016
Limiting input number between minimum and maximum values range in Python
View limit-number.py
def limit(num, minimum=1, maximum=255):
"""Limits input 'num' between minimum and maximum values.
Default minimum value is 1 and maximum value is 255."""
return max(min(num, maximum), minimum)
@baybatu
baybatu / attach-listener-to-push-method.js
Last active Jan 16, 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 / 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
@baybatu
baybatu / finagle-http2-frame-logger.md
Last active Dec 24, 2020
Log http2 frames on a finagle service
View finagle-http2-frame-logger.md
import com.twitter.finagle.http2.param.FrameLoggerNamePrefix
val service =
        Http
          .client
          .withLabel("service-label")
          .configured(FrameLoggerNamePrefix(this.getClass.getName))
          .withHttp2
          .newService("localhost:8080")
@baybatu
baybatu / docker-overwrite-entrypoint.md
Last active Dec 17, 2020
Run command in a docker container without running entrypoint
View docker-overwrite-entrypoint.md
@baybatu
baybatu / get-huawei-oauth2-token.md
Last active Dec 8, 2020
Get Huawei oauth2 token
View get-huawei-oauth2-token.md
curl --location --request POST 'https://oauth-login.cloud.huawei.com/oauth2/v3/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=client_credentials' \
  --data-urlencode 'client_secret=CLIENT_SECRET' \
  --data-urlencode 'client_id=CLIENT_ID'

CLIENT_SECRET: 'App Secret' field on Huawei UI