Skip to content

Instantly share code, notes, and snippets.

View baybatu's full-sized avatar
🏠
Working from home

Batuhan Bayrakci baybatu

🏠
Working from home
View GitHub Profile
@baybatu
baybatu / get-huawei-oauth2-token.md
Last active December 8, 2020 08:33
Get Huawei oauth2 token
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

@baybatu
baybatu / parse-iso8601-format-bigquery.md
Created November 27, 2020 06:49
Parse ISO8601 format in BigQuery
@baybatu
baybatu / active-forks.md
Created October 28, 2020 13:22
Find most active github forks easily
@baybatu
baybatu / netscaler-cors-policy.txt
Last active September 17, 2020 13:45
Netscaler CORS configuration policy for multiple domains with their subdomains
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 April 10, 2020 13:58
Prevent clicking button automatically when press 'Enter' in Clarity
@baybatu
baybatu / README.md
Created March 5, 2020 12:03 — forked from Bonno/README.md
Opening multiple SSH sessions with iTerm automatically. To be used in an Automator flow.

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 February 25, 2020 06:07
Create spark session using hive metastore on local
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 February 20, 2020 19:31
Converting string to number in Javascript (ES5)
function toNumber(value) {
var convertedNumber = +value;
if (convertedNumber) {
return convertedNumber;
}
throw Error("Conversion error for value:" + value);
}
@baybatu
baybatu / tcpdump-osx.sh
Created February 17, 2020 06:29
Getting network traffic of an application by PID on OSX
sudo tcpdump -Q pid=PID -k
@baybatu
baybatu / show-external-location-of-hive-table.md
Created February 6, 2020 07:26
Getting whole DDL of a hive table