Skip to content

Instantly share code, notes, and snippets.

View ahmet-cetinkaya's full-sized avatar
🏠
Working from home

Ahmet Çetinkaya ahmet-cetinkaya

🏠
Working from home
View GitHub Profile
@ahmet-cetinkaya
ahmet-cetinkaya / ender-3-pro-bl-touch-custom-end.gcode
Last active March 11, 2024 13:24
Ender 3 Pro BL-Touch Custom Start and End G-Code
; Ender 3 Custom End G-Code v1.2 ; https://gist.github.com/ahmet-cetinkaya/4fea5998f3fe1a1958d5587479959313
G4 ; Wait
M220 S100 ; Reset Speed factor override percentage to default (100%)
M221 S100 ; Reset Extrude factor override percentage to default (100%)
M140 S0 ; Turn-off bed
G91 ; Set relative positioning
G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely
G1 X5 Y5 F3000 ; Wipe out
G1 F1800 E-50 ; Retract filament 50 mm to prevent oozing and deformation
@ahmet-cetinkaya
ahmet-cetinkaya / CoinChange.cs
Created July 18, 2022 11:24
Leetcode Solution - 322. Coin Change
public class Solution
{
public int CoinChange(int[] coins, int amount)
{
int[] dp = new int[amount + 1];
Array.Fill(dp, amount + 1);
dp[0] = 0;
for (int i = 0; i <= amount; ++i)
@ahmet-cetinkaya
ahmet-cetinkaya / btuValue.fis
Last active June 11, 2022 20:46
BTU energy unit deduce in cooling systems with fuzzy logic - MATLAB
[System]
Name='btuValue_v0.7.3'
Type='mamdani'
Version=2.0
NumInputs=5
NumOutputs=1
NumRules=132
AndMethod='min'
OrMethod='max'
ImpMethod='min'
@ahmet-cetinkaya
ahmet-cetinkaya / skipSilenceSyncFixTampermonkey.js
Last active April 22, 2022 08:47
Skip Silence Audio and Video Sync Fix - Tampermonkey
// ==UserScript==
// @name Skip Silence Sync Fix
// @namespace ahmetcetinkaya.me
// @version 1.0.2
// @description Fixing audio and video sync.
// @author ahmetcetinkaya <ahmetcetinkaya7@outlook.com>
// @match *://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
@ahmet-cetinkaya
ahmet-cetinkaya / AutoCloseVoicemeeter.ahk
Last active November 10, 2021 07:33
Autohotkey script to Auto-close the Voicemeeter windows that open when startup.
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
@ahmet-cetinkaya
ahmet-cetinkaya / perfectNumbers.js
Created November 3, 2021 14:25
Perfect Numbers - Javascript
// Helper
const findDivisors = number => {
const divisors = [1];
for (let i = 2; i < number - 1; ++i) if (number % i === 0) divisors.push(i);
return divisors;
};
const sum = (...numbers) => numbers.reduce((a, b) => a + b);
// Perfect Number
const isPerfectNumber = number => sum(...findDivisors(number)) === number;
@ahmet-cetinkaya
ahmet-cetinkaya / friendlyNumbers.js
Created November 3, 2021 14:25
Friendly Numbers - Javascript
// Helpers
const findDivisors = number => {
const divisors = [1];
for (let i = 2; i < number - 1; ++i) if (number % i === 0) divisors.push(i);
return divisors;
};
const sum = (...numbers) => numbers.reduce((a, b) => a + b);
// Friendly Numbers
const areFriendlyNumbers = (number, number2) =>
@ahmet-cetinkaya
ahmet-cetinkaya / primeNumbers.js
Created November 3, 2021 14:22
Prime Numbers - Javascript
// Prime Number
const isPrime = number =>
number > 1 &&
Array(Math.floor(Math.sqrt(number)) - 1)
.fill(0)
.map((_, i) => i + 2)
.every(i => number % i !== 0);
function isPrime2(number) {
if (number < 1) return false;
@ahmet-cetinkaya
ahmet-cetinkaya / IsIsomorphic.cs
Created October 17, 2021 21:09
Leetcode Solution - 205. Isomorphic Strings
public class Solution {
public bool IsIsomorphic(string s, string t) {
var length = s.Length;
var dict = new Dictionary<char, char>();
for (var i = 0; i < length; ++i)
if (dict.ContainsKey(s[i]))
{
if (dict[s[i]] != t[i]) return false;
}
else
@ahmet-cetinkaya
ahmet-cetinkaya / NumIdenticalPairs.cs
Last active October 13, 2021 21:06
Leetcode Solution - 1512. Number of Good Pairs
public class Solution {
public int NumIdenticalPairs(int[] nums) {
var sum = 0;
var arr = new int[101];
foreach (var num in nums) sum += arr[num]++;
return sum;
}
}
// Result: https://leetcode.com/submissions/detail/570762775/