Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / active-forks.md
Created Oct 28, 2020
Find most active github forks easily
@baybatu
baybatu / netscaler-cors-policy.txt
Last active Sep 17, 2020
Netscaler CORS configuration policy for multiple domains with their subdomains
View netscaler-cors-policy.txt
add policy patset CORS_origins_allowed
bind policy patset CORS_origins_allowed .validdomain1.com -index 1
bind policy patset CORS_origins_allowed .validdomain2.com -index 2
add responder action CORS_deny_response respondwith q{"HTTP/1.0 401 Unauthorized CORS\r\n\r\n"} -bypassSafetyCheck YES
add responder policy CORS_origin_denied `!(HTTP.REQ.HEADER("Origin").EXISTS && HTTP.REQ.HEADER("Origin").TYPECAST_HTTP_URL_T.HOSTNAME.CONTAINS_ANY("CORS_origins_allowed"))` CORS_deny_response
@baybatu
baybatu / prevent-form-submit-clarity.md
Created Apr 10, 2020
Prevent clicking button automatically when press 'Enter' in Clarity
View prevent-form-submit-clarity.md
@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

You can’t perform that action at this time.