Skip to content

Instantly share code, notes, and snippets.

View berkorbay's full-sized avatar
🏄

Berk Orbay berkorbay

🏄
  • Tideseed
  • Istanbul, Turkey
  • 05:07 (UTC +03:00)
View GitHub Profile
@berkorbay
berkorbay / terminal_commands.txt
Last active May 3, 2018 11:04
Some terminal commands
sudo apt-get -y update && sudo apt-get -y upgrade
sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get -y update
sudo apt-get -y install r-base
sudo apt-get -y install libcurl4-openssl-dev libssl-dev libxml2-dev
@berkorbay
berkorbay / shinyproxy_steps.txt
Last active May 3, 2018 13:25
shinyproxy steps
#See https://www.shinyproxy.io/getting-started/
sudo nano /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// -D -H tcp://127.0.0.1:2375
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker pull openanalytics/shinyproxy-demo
install.packages(c('tinytex', 'rmarkdown','blogdown'))
tinytex::install_tinytex()
@berkorbay
berkorbay / mef_bda_503_2018_week_4.r
Last active April 3, 2019 12:20
Week 4 preparation
pti <- c("shiny","tidyverse","ggplot2movies")
pti <- pti[!(pti %in% installed.packages())]
if(length(pti)>0){
install.packages(pti)
}
##########
### Shiny starter code
##########
library(shiny)
@berkorbay
berkorbay / r_baslangic.R
Created February 8, 2019 07:44
R'a başlangıç için kurulması gereken paketler / R starter packages
## Önce aşağıdakiler linklerinden programlar indirilerek kurulmalı
# R https://cran.r-project.org/
# RStudio Desktop https://www.rstudio.com/products/rstudio/download/
# Pandoc https://pandoc.org/installing.html
# LaTeX https://www.latex-project.org/get/
# Kurulması gereken paket listesi
# Bütün kodu kopyala yapıştır ile R'a koyun Hata alınan paketler olursa bazı başka kütüphanelerin yüklenmesi gerekebilir (ör. openssl)
pti <- c("devtools","tidyverse","shiny","shinydashboard","readxl","writexl","lubridate","reticulate","stringr","openxlsx","ggiraph","rhandsontable","shinycssloaders","rmarkdown","DBI","RMySQL","shinyjs","promises","future","ggmap","rlist","anytime","xml2","jsonlite","data.table")
pti<-pti[!(pti %in% installed.packages())]
@berkorbay
berkorbay / ibb_open_data_ispark_query.R
Created January 19, 2020 13:51
İBB Açık Veri APIsini kullanarak İSPARK lokasyonlarını bir data frame'e indirip tibble'a dönüştürme kodu
## Paketler yüklü değilse install.packages kullanın
## install.packages(c("tidyverse","jsonlite"),repos="https://cran.r-project.org")
library(tidyverse)
library(jsonlite)
ispark_query_url <- "https://data.ibb.gov.tr/api/3/action/datastore_search_sql?sql=SELECT%20*%20from%20%22c3eb0d72-1ce4-4983-a3a8-6b0b4b19fcb9%22"
raw_value <- fromJSON(ispark_query_url)
raw_df <- raw_value$result$records %>% rename_all(~gsub("^_","",.)) %>% rename_all(~gsub(" |\\(|\\)|/","_",.)) %>% tbl_df()
@berkorbay
berkorbay / ibb_open_data_query_function.R
Created January 19, 2020 18:52
İBB Açık Veri Portalı'ndan veri çekme R fonksiyonu
## İlgili veri setinde önizleme'ye tıklayın çıkan url adresinde "/resource/"tan sonraki kodu kopyalayın (data_id)
ibb_data_pull <- function(data_id="e1e2b771-b4de-49d3-b779-17b4bba10fb7"){
ibb_query_url <- paste0("https://data.ibb.gov.tr/api/3/action/datastore_search_sql?sql=SELECT%20*%20from%20%22",data_id,"%22")
json_query_response <- jsonlite::fromJSON(ibb_query_url)
return_df <- json_query_response$result$records %>% rename_all(~gsub("^_","",.)) %>% rename_all(~gsub(" |\\(|\\)|/","_",.)) %>% tbl_df()
return(return_df)
@berkorbay
berkorbay / ibb_solar_panel_analysis.R
Created January 19, 2020 18:56
İBB Açık Veri Portalı İkitelli Güneş Enerjisi Santrali üretim verisi inceleme kodu
library(tidyverse)
library(lubridate)
library(jsonlite)
library(devtools)
#https://data.ibb.gov.tr/dataset/ikitelli-gunes-enerjisi-santrali-elektrik-uretim-miktarlari/resource/52afa9a3-2ea1-420b-a783-505cfe635ece
devtools::source_gist("https://gist.github.com/berkorbay/493e82b3d48245317c57a5d0c334492e")
raw_df <- ibb_data_pull("52afa9a3-2ea1-420b-a783-505cfe635ece")
wip_df <- raw_df %>% transmute(dt = as_datetime(Tarih),production=as.numeric(Uretim__kWh_))
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active July 9, 2025 21:52
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@berkorbay
berkorbay / qnb_finansbank_api_v0.r
Created April 6, 2020 19:03
QNB Finansbank Rest API Methods
# Source: https://developer.qnbfinansbank.com
# Currently in beta phase so we DO NOT use id and secret instead we use a "code" from one of the accounts.
# Go to: https://developer.qnbfinansbank.com/discovery/GettingStarted/UseTestPlatform
## Follow steps until step 5. The code you get is your token
url = "https://sandbox-api.qnbfinansbank.com/v0/accounts"
my_token = "MY_VERY_LONG_TOKEN"
resval <- httr::GET(url, httr::add_headers(Authorization = paste("Bearer", the_token, sep = " ")))