Skip to content

Instantly share code, notes, and snippets.

View CagriAldemir's full-sized avatar

Çağrı Aldemir CagriAldemir

View GitHub Profile
@CagriAldemir
CagriAldemir / go-installation-with-gvm.md
Created October 26, 2022 07:38
GO Installation with GVM

GO Installation with GVM

For the reason here, you should follow the steps below before installing the first GO version with GVM;

  • Download latest GO version as archive from here.
  • Extract archive.
  • Execute this command in terminal to add GO path temporarily; export PATH="$PATH:/Users/cagrialdemir/Desktop/go/bin"
  • Install latest GO version with GVM; gvm install go1.19.2
  • Use downloaded GO and set it as default; gvm use go1.19.2 --default
  • Now, you can delete temporarily downloaded GO folder; rm -rf /Users/cagrialdemir/Desktop/go
@CagriAldemir
CagriAldemir / keybindings.json
Created September 1, 2022 10:12
VSCode Dual Document Format (Prettier + ESLint)
[
{
"key": "alt+cmd+l",
"command": "-editor.action.formatDocument",
"when": "config.workspaceKeybindings.dualDocumentFormat.enabled && editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
},
{
"key": "alt+cmd+l",
"command": "workbench.action.tasks.runTask",
"args": "format-prettier-eslint",
@CagriAldemir
CagriAldemir / oxford_3000.json
Created May 25, 2021 23:06
Oxford 3000 Word TR-EN JSON File
[
{
"tr": "bir",
"en": "a"
},
{
"tr": "terk etmek",
"en": "abandon"
},
{
@CagriAldemir
CagriAldemir / local-storage-listener.js
Last active May 25, 2021 23:03
Browser Event Listeners
const localStorageSubscribers = [];
const initLocalStorageListener = () => {
document.addEventListener('storage', handleLocalStorageChange, false);
};
const removeLocalStorageListener = () => {
localStorageSubscribers.length = 0;
document.removeEventListener('storage', handleLocalStorageChange);
};

Git Cheat Sheet

Delete Last Commit without Losing the Changes
git reset --soft HEAD^

#If you want to delete from remote;
git push -f

Docker CLI Commands

Build Image from Dockerfile
docker build --tag <image-name>:<tag> <dockerfile-path>

#EXAMPLE
docker build --tag my-image:1.2.3 .
#or
docker build --tag my-image:1.2.3 ./dockerfile
@CagriAldemir
CagriAldemir / EpochTimeHistory.py
Created June 7, 2020 23:14
Classification of IMDB Movie Review Dataset Using LSTM and CNN (Machine Learning Final Project)
import time
import keras
getCurrentTime = lambda: int(round(time.time() * 1000))
class TimeHistory(keras.callbacks.Callback):
def on_epoch_begin(self, batch, logs={}):
self.epoch_time_start = getCurrentTime()
import matplotlib.pyplot as plt
import numpy as np
import skfuzzy as fuzz
import skfuzzy.membership as mf
x_pedal = np.arange(0, 101, 1)
x_speed = np.arange(0, 101, 1)
y_brake = np.arange(0, 101, 1)
pedal_low = mf.trimf(x_pedal, [0, 0, 50])
export class DemoClass {
public foo: string;
public bar: string;
public fooLabel: string;
public barLabel: string;
toJSON() {
return {
foo: this.foo,