Skip to content

Instantly share code, notes, and snippets.

View yigitozgumus's full-sized avatar
🎯
Focusing

Yiğit Özgümüş yigitozgumus

🎯
Focusing
View GitHub Profile
@yigitozgumus
yigitozgumus / ViolationExample.kt
Last active December 12, 2023 11:17
Example MVVM Violation
override fun showVariantSelectionDialog(pageType: String) {
// Direct data access
val product = productDetailViewModel.getProduct()
if (product == null) {
showProductDetailErrorDialog()
return
}
variantSelectionDialogProvider.provideVariantSelectionDialog(
content = getVariantSelectionContent(product, pageType),
anyVariantSelectedListener = {
@yigitozgumus
yigitozgumus / ListUpdateMethods.kt
Created August 20, 2023 16:42
Various Immutable List element update methods in Kotlin
import kotlin.random.Random
import kotlin.random.nextInt
import kotlin.time.measureTime
fun main() {
val dataset = ExperimentData(listSize = 100, updateTimes = 5000000)
val experiments = mutableListOf<Experiment>()
@yigitozgumus
yigitozgumus / obsidian_sync.sh
Created January 31, 2021 12:39
This script updates the repo if any change is performed
#!/bin/sh
CHANGES_EXIST="$(git status --porcelain | wc -l)"
if [ "$CHANGES_EXIST" -eq 0 ]; then
exit 0
fi
git stash
git pull
@yigitozgumus
yigitozgumus / install_obsidian_sync.sh
Created January 31, 2021 12:39
This script helps you to syncronize your notes to a private repo periodically
#!/bin/bash
OBSIDIAN_CONFIG="obsidian_sync.sh"
LOCATION=$( echo `pwd` | sed 's/ /\\ /g' )
# Obsidian repo sync
crontab -l
echo "0 22 * * * cd "${LOCATION}" ; ./${OBSIDIAN_CONFIG} >> /tmp/cron.out 2>&1" | sort - | uniq - | crontab -
printf "\nCronjob is added.\n"
@yigitozgumus
yigitozgumus / fetch.py
Created November 29, 2020 20:15
Simple function for downloading small datasets
def fetch(url):
import requests, gzip, os, hashlib, numpy, sys
fp = os.path.join("/tmp", hashlib.md5(url.encode('utf-8')).hexdigest())
if os.path.isfile(fp):
with open(fp, "rb") as f:
data = f.read()
else:
with open(fp, "wb") as f:
data = requests.get(url).content
@yigitozgumus
yigitozgumus / update_project_repos.py
Created September 21, 2020 20:29
simple python program to update project manager projects.
import os
from contextlib import contextmanager
import json
def listdir_nohidden(path: str) -> None:
return sorted([f for f in os.listdir(path) if "." not in f], key=str.lower)
@contextmanager
def working_dir(directory: str) -> None:
@yigitozgumus
yigitozgumus / Analysis.ipynb
Created October 23, 2019 09:09
Masomo-Case-Study
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yigitozgumus
yigitozgumus / insider_recommender_interview.ipynb
Last active October 10, 2019 15:03
insider_recommender_interview.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yigitozgumus
yigitozgumus / GIF-Screencast-OSX.md
Created June 25, 2018 16:54 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@yigitozgumus
yigitozgumus / quicksort.py
Last active May 14, 2018 12:49
Quicksort class implementation
def quicksort(arr):
p = 0
r = len(arr) - 1
solve_recursive(arr,p,r)
def solve_recursive(arr,p,r):
if(p<r):
q = partition(arr,p,r)