Skip to content

Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

Block or report user

Report or block baybatu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@baybatu
baybatu / README.md
Created Mar 5, 2020 — forked from Bonno/README.md
Opening multiple SSH sessions with iTerm automatically. To be used in an Automator flow.
View README.md

Create a new Automater flow

Add 'Service'. Service receives 'no input' in 'iTerm'. Add 'Run AppleScript'.

@baybatu
baybatu / spark-session-for-local-with-hive.java
Created Feb 25, 2020
Create spark session using hive metastore on local
View spark-session-for-local-with-hive.java
SparkSession spark = SparkSession
.builder()
.appName("com.baybatu.sparkApp")
.master("local[*]")
.enableHiveSupport()
.config("dfs.nameservices", "nameService01")
.config("hive.metastore.uris", "thrift://10.20.30.40:8093")
.getOrCreate();
@baybatu
baybatu / string-to-number.js
Last active Feb 20, 2020
Converting string to number in Javascript (ES5)
View string-to-number.js
function toNumber(value) {
var convertedNumber = +value;
if (convertedNumber) {
return convertedNumber;
}
throw Error("Conversion error for value:" + value);
}
@baybatu
baybatu / tcpdump-osx.sh
Created Feb 17, 2020
Getting network traffic of an application by PID on OSX
View tcpdump-osx.sh
sudo tcpdump -Q pid=PID -k
@baybatu
baybatu / java-ontanimli-kuralla-siralama.md
Created Dec 9, 2019
Java'da öntanımlı bir listeye göre sıralama yapmak
View java-ontanimli-kuralla-siralama.md
List<String> kurallar = Arrays.asList("ahmet", "veli", "mehmet");
List<String> sonuc = Arrays.asList("veli", "mehmet", "ahmet").stream()
  .sorted(Comparator.comparing(isim -> kurallar.indexOf(isim)))
  .collect(Collectors.toList());
assertThat(sonuc).isEqualTo(Arrays.asList("ahmet", "veli", "mehmet"));

Kaynak: https://stackoverflow.com/a/5245214

@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 / twitterserver-admin-port.md
Last active Aug 29, 2019
Specifying admin port on TwitterServer
View twitterserver-admin-port.md

Pass following as program an argument

java -jar app.jar -admin.port=:9999
You can’t perform that action at this time.