Skip to content

Instantly share code, notes, and snippets.

View berkorbay's full-sized avatar
🤖
talk to my agent (kidding)

Berk Orbay berkorbay

🤖
talk to my agent (kidding)
  • Tideseed
  • Istanbul, Turkey
  • 03:24 (UTC +03:00)
View GitHub Profile
@berkorbay
berkorbay / hizli_blok_bot_v0.py
Created August 25, 2023 16:04
Robokami hızlı blok bot
### DİKKAT!
### İlgili bot sadece Robokami'nin işleyişini gösterim amaçlıdır.
### Robokami ve Tideseed botun çalışması ve işlevi dahil hiçbir konuda bir garanti vermemektedir ve herhangi bir sorumluluk kabul etmemektedir.
### İlgili kodun lisansı Apache License 2.0 lisansına uygundur.
### Detaylı bilgi ve sorular için https://robokami.com adresine başvurabilirsiniz.
from robokami.main import RKClient
import json
import copy
## Birinci hesabın bilgileri
@berkorbay
berkorbay / le_hourly_contracts.json
Created July 3, 2023 09:23
Robokami Stream Data Formats
{
"id": "1688375491.446317",
"event": "le",
"data": {
"c": "PH23070315",
"bid_bp": 2120.12,
"ask_bp": 2249.88,
"bid_bq": 163,
"ask_bq": 4,
"p_min": 1987.11,
@berkorbay
berkorbay / foreign_students_report_starter_code.qmd
Last active April 26, 2023 14:42
YOK Foreign Students Data Starter Code for Tidyverse (dplyr + ggplot2) and Quarto
---
title: "Yabancı Öğrenci Raporu (Örnek)"
author: "MEF MGMT 553 2022-2023 Bahar Dönemi"
format: pptx
editor: visual
execute:
echo: false
message: false
warning: false
---
@berkorbay
berkorbay / cloud_run.md
Last active February 13, 2025 09:47
GCP (gcloud) ops cheat sheet
@berkorbay
berkorbay / relative_import.md
Created January 19, 2023 14:45
Relative import methods in Python
  1. Best way is editable pip packages (reference)

pip install --editable /path/to/package

You need to include a minimal setup.py

from setuptools import setup, find_packages

setup(
@berkorbay
berkorbay / os_sys_upper_directories.py
Created October 17, 2022 07:38
Getting to upper directories in Python
### This gist gives you the code snippet to reach upper directories
### so you can reach other functions in the document
### e.g. from mainfolder.subfolder.subfolder.examplefile import example_function
#### Include upper dirs start
dpath = os.path.dirname(os.path.abspath(__file__))
for i in range(4):
dpath = os.path.dirname(dpath)
sys.path.insert(1, dpath)
#### Include upper dirs end
@berkorbay
berkorbay / r_highs_ompr_example.R
Created September 29, 2022 15:10
R example of modelling with HiGHS solver and ompr framework
#######
### This is a minimal example of using HiGHS solver in R with the help of ROI and ompr packages.
#######
## SETUP BEGIN
pti <- c("ompr.roi","ompr","highs","devtools")
pti <- pti[!(pti %in% installed.packages())]
if(length(pti) > 0){
install.packages(pti)
}
@berkorbay
berkorbay / pandas_reorder_columns.py
Created April 18, 2022 14:37
Small function to reorder columns using Pandas. This is a quick and dirty approach. I'm pretty sure there are better alternatives.
import pandas as pd
def pd_reorder_cols(df, d):
"""
Reorders the position of columns with the given specs dictionary.
"""
cl = list(df.columns)
for k1, v1 in d.items():
k1_ix = cl.index(k1)
cl.pop(k1_ix)
@berkorbay
berkorbay / mwe_fragment.Rmd
Created December 22, 2021 22:27
RMarkdown include an HTML fragment within an HTML fragment and how to solve <!DOCTYPE html> print problem.
---
output:
html_fragment:
self_contained: false
always_allow_html: true
---
```{=html}
<!DOCTYPE html>
```
@berkorbay
berkorbay / read_xlsx_to_pandas_fast.py
Created August 3, 2021 18:49
Blazing fast of xlsx files into pandas
from datatable import fread
import pandas as pd
excel_path = "my_excel_file.xlsx"
df = fread(excel_path+"/sheet_name").to_pandas()