Skip to content

Instantly share code, notes, and snippets.

Avatar
👹

Kemal Erdem burnpiro

👹
View GitHub Profile
@burnpiro
burnpiro / v8.md
Last active Oct 2, 2020
Basic V8 guide
View v8.md

Install V8 on Linux

Requirements

  • git

Installation

depot_tools

@burnpiro
burnpiro / functionOptimisation.md
Created Aug 1, 2019
Spread VS JSON.parse performance in function optimisation
View functionOptimisation.md

Spread vs JSON.parse speed when calling simple function

const N = 100000;

function test(obj) {
  var result = obj.a + obj.b;
  return result;
}
function test2(obj) {
  var result = obj.a + obj.b;
@burnpiro
burnpiro / fiberInternals.md
Last active Aug 9, 2019
Simple React Fiber Internals
View fiberInternals.md

run following code with

d8 --trace-ic --allow-natives-syntax --trace-maps index.js
const N = 100000;

class Component {
@burnpiro
burnpiro / index.js
Last active Nov 7, 2019
Performance test of JSF convention
View index.js
This file has been truncated, but you can view the full file.
@burnpiro
burnpiro / index.js
Created Nov 7, 2019
Performance test function call JS
View index.js
const startT1 = Date.now();
const N = 10000;
let f = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Gandalf', b: 'The Grey' };
let f2 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Jack', b: 'Sparrow' };
let f3 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Charles', b: 'Xavier' };
let f4 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Frodo', b: 'Baggins' };
let f5 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Legolas', b: 'Thranduilion' };
let f6 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Indiana', b: 'Jones' };
@burnpiro
burnpiro / index.js
Created Nov 7, 2019
Performance test eval multi function call JS
View index.js
eval(`
const startT1 = Date.now();
const N = 10000;
let f = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Gandalf', b: 'The Grey' };
let f2 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Jack', b: 'Sparrow' };
let f3 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Charles', b: 'Xavier' };
let f4 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Frodo', b: 'Baggins' };
let f5 = { tmp: 3, tmp2: 3, tmp3: 3, tmp4: 3, tmp5: 3, a: 'Legolas', b: 'Thranduilion' };
@burnpiro
burnpiro / a_train.py
Last active Jan 22, 2021
Tensorflow 2 custom dataset Sequence
View a_train.py
import tensorflow as tf
from data.data_generator import DataGenerator
from config import cfg
## Create train dataset
train_datagen = DataGenerator(file_path=cfg.TRAIN.DATA_PATH, config_path=cfg.TRAIN.ANNOTATION_PATH)
## Create validation dataset
val_generator = DataGenerator(file_path=cfg.TEST.DATA_PATH, config_path=cfg.TEST.ANNOTATION_PATH, debug=False)
@burnpiro
burnpiro / data_info.py
Created Jul 31, 2020
DengAI data info
View data_info.py
LABEL_COLUMN = 'total_cases'
NUMERIC_COLUMNS = ['year',
'weekofyear',
'ndvi_ne',
'ndvi_nw',
'ndvi_se',
'ndvi_sw',
'precipitation_amt_mm',
'reanalysis_air_temp_k',
'reanalysis_avg_temp_k',
View preproc_data.py
import pandas as pd
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from data_info import cols_to_norm, cols_to_scale
def preproc_data(data, norm_cols=cols_to_norm, scale_cols=cols_to_scale, train_scale=None):
"""
:param data: Dataframe
:param norm_cols: List<string>
:param scale_cols: List<string>
:param train_scale: Dataframe
:return: Tuple(Dataframe, Dataframe)
View test.py
if norm_cols:
# Normalize temp and percipation
new_data[norm_cols] = StandardScaler().fit(train_scale[norm_cols]).transform(new_data[norm_cols])