Skip to content

Instantly share code, notes, and snippets.

View sbalci's full-sized avatar
🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸

Serdar Balcı sbalci

🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸
View GitHub Profile
@sbalci
sbalci / webr-experiments.R
Created April 8, 2023 19:31 — forked from hrbrmstr/webr-experiments.R
Janky R script to create the HTML page for https://rud.is/webr-experiments/
#!/usr/bin/env Rscript
library(httr, include.only = c("GET", "add_headers", "content"))
library(jsonlite, include.only = c("fromJSON", "write_json"))
library(glue, include.only = c("glue"))
GITHUB_TOKEN <- Sys.getenv("GITHUB_TOKEN")
JSON_FILE <- "webr-experiments.json"
HTML_FILE <- "webr-experiments/index.html"
@sbalci
sbalci / il.csv
Created February 19, 2023 19:38 — forked from mebaysan/il.csv
Türkiye İller CSV
plaka il_adi lat lon northeast_lat northeast_lon southwest_lat southwest_lon
1 ADANA 37.00000000 35.32133330 37.07200400 35.46199500 36.93552300 35.17470600
2 ADIYAMAN 37.76416670 38.27616670 37.82566700 38.33546500 37.71708600 38.18818800
3 AFYONKARAHİSAR 38.76376000 30.54034000 38.80210500 30.61116700 38.71428900 30.44232000
4 AĞRI 39.72166670 43.05666670 39.74860500 43.08524100 39.68814400 43.00177800
5 AMASYA 40.65000000 35.83333330 40.67283400 35.85632100 40.63691100 35.78909100
6 ANKARA 39.92077000 32.85411000 40.10098100 33.02486600 39.72282100 32.49909700
7 ANTALYA 36.88414000 30.70563000 36.97517800 30.84095300 36.78586600 30.51609500
8 ARTVİN 41.18333330 41.81666670 41.20707800 41.85479900 41.15541500 41.77736100
9 AYDIN 37.84440000 27.84580000 37.87099700 27.88535500 37.81957300 27.79052200
@sbalci
sbalci / connected_ggiraph.R
Created January 29, 2023 11:12 — forked from AlbertRapp/connected_ggiraph.R
connected_ggiraph.R
library(dplyr)
library(ggplot2)
library(patchwork)
library(ggiraph)
dat <- gapminder::gapminder |>
janitor::clean_names() |>
mutate(
# ID that is shared for boxplots (this one uses factors, i.e. numbers, as ID instead of continents)
@sbalci
sbalci / this_file_path.R
Created December 3, 2022 19:47 — forked from jasonsychau/this_file_path.R
R - get this file path
# a combination of
# https://stackoverflow.com/questions/1815606/determine-path-of-the-executing-script/15373917#15373917
# https://stackoverflow.com/questions/1815606/determine-path-of-the-executing-script/7585599#7585599
# https://stackoverflow.com/questions/47044068/get-the-path-of-current-script/47045368#47045368
# https://stackoverflow.com/questions/53512868/how-to-automatically-include-filepath-in-r-markdown-document/53516876#53516876
stub <- function() {}
thisPath <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
if (length(grep("^-f$", cmdArgs)) > 0) {
# R console option
@sbalci
sbalci / check-rproj-dupes.R
Created July 9, 2022 19:45 — forked from matt-dray/check-rproj-dupes.R
Check for open RStudio Projects that have the same name (macOS only for now)
check_rproj_dupes <- function() {
os <- .Platform$OS.type
if (os == "unix") {
ps_out <- system("ps -e", intern = TRUE)
ps_rproj <- ps_out[grepl(".Rproj", ps_out)]
ps_split <- strsplit(ps_rproj, "\\s")
rproj_paths <- lapply(ps_split, function(x) x[grepl(".Rproj$", x)])
@sbalci
sbalci / nycflights_calender.qmd
Created July 9, 2022 14:59 — forked from AlbertRapp/nycflights_calender.qmd
NYC flights calendar plot
library(tidyverse)
color_palette <- thematic::okabe_ito(8)
flights <- nycflights13::flights
counts <- flights %>%
mutate(
date = lubridate::make_date(year = year, month = month, day = day)
) %>%
count(date) %>%
mutate(
@sbalci
sbalci / dialog.html
Created February 25, 2022 14:07 — forked from coinsandsteeldev/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
function drawForm() {
if (!data) return
var outputEl = document.getElementById(formId);
@sbalci
sbalci / dialog.html
Created February 25, 2022 14:07 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<div style="font-family: sans-serif;">
<? var data = valid(); ?>
<form id="form" name="form">
<? if(Object.prototype.toString.call(data) === '[object Array]') { ?>
<? for (var i = 0; i < data.length; i++) { ?>
<? for (var j = 0; j < data[i].length; j++) { ?>
<input type="checkbox" id="ch<?= '' + i + j ?>" name="ch<?= '' + i + j ?>" value="<?= data[i][j] ?>"><?= data[i][j] ?><br>
<? } ?>
<? } ?>
<? } else { ?>
@sbalci
sbalci / multiple-repository-and-identities-git-configuration.md
Created February 5, 2022 10:48 — forked from bgauduch/multiple-repository-and-identities-git-configuration.md
Git config with multiple identities and multiple repositories

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@sbalci
sbalci / delete_git_submodule.md
Created January 11, 2022 16:49 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule