Skip to content

Instantly share code, notes, and snippets.

View eralpkaraduman's full-sized avatar
🐊
ᑴ ͡° ͟ʖ ͡°ᑷ

Eralp Karaduman eralpkaraduman

🐊
ᑴ ͡° ͟ʖ ͡°ᑷ
View GitHub Profile
@eralpkaraduman
eralpkaraduman / useThrottledCallback.ts
Last active January 5, 2023 15:55
useCallback with lodash's throttle
import { DependencyList, useCallback } from 'react';
import { throttle } from 'lodash';
export function useThrottledCallback<A extends Array<unknown>, R extends unknown>(
callback: ((...args: A) => R) | undefined,
wait: number,
extraDeps: DependencyList = [],
): (...args: A) => R | undefined {
return useCallback(
@eralpkaraduman
eralpkaraduman / gist:06351d88145b77d4fa759338a2a1a3d1
Created July 4, 2021 14:12
Patch San Fransisco Mono Font With Nerdfonts
#!/usr/bin/env
mkdir -p ~/patched-fonts/in
mkdir -p ~/patched-fonts/out
echo "Download SF mono Download https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"
echo "Install it"
echo "Open FontBook and copy all SF Mono fonts to ~/patched-fonts/in"
read -p "Press enter to continue when you are done"
@eralpkaraduman
eralpkaraduman / command.sh
Created June 7, 2021 20:26
Check chia farm over ssh siri shortcut script
(cd chia-blockchain/ && . ./activate && chia farm summary && chia show -s && chia wallet show) | grep -E 'Block rewards:|Sync status:|Total chia farmed:|Expected time to win:|Plot count:|Estimated network space:|Farming status:'
@eralpkaraduman
eralpkaraduman / refresh-plex.sh
Created November 12, 2019 23:05
refreshing PLEX libraries by $LIBRARY_KEY using http api
# Install Dependency: apt-get install jq
$PLEX_USERNAME="[email protected]"
$PLEX_PASSWORD="yourpassword"
$LIBRARY_TITLE="Movies" #TV, Music, etc
PLEX_TOKEN=`curl -s -X POST \
-H "X-Plex-Client-Identifier: jenkins" \
-H "X-Plex-Product: jenkins" \
-H "X-Plex-Version: 1.0.0" \
@eralpkaraduman
eralpkaraduman / README.md
Last active October 3, 2019 16:31
THIS IS HOW I MAKE PIXEL ART STUFF

THIS IS HOW I MAKE PIXEL ART STUFF

This is about;

  • How i draw them
  • How i scale them
  • How do i make a history timelapse video
  • How do i convert between file formats

The most tricky thing is to scale pixel art without losing the blockiness with

@eralpkaraduman
eralpkaraduman / click-delay-repeat.APPLESCRIPT
Last active May 18, 2018 13:57
Applescript for clicking on safari repeatedly with delay
on run {input, parameters}
repeat 300 times
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click at {300, 100} -- {from left, from top}
end tell
# Solves these issues;
# * Wireles headphone pairing takes forever
# * Wireles headphone is paired but keeps disconnecting
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0
sudo defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 1
@eralpkaraduman
eralpkaraduman / index.js
Created February 6, 2018 15:48
converting list of urls to netscape bookmarks html export format
var netscape = require('netscape-bookmarks');
var fs = require('fs');
var bookmarksList = fs.readFileSync('readinglistlinksfromsafari.txt').toString().split("\n");
var bookmarksObj = bookmarksList.reduce((acc, url) => {
var title = url;
acc[title] = url;
return acc;
}, {});

Keybase proof

I hereby claim:

  • I am eralpkaraduman on github.
  • I am eralp (https://keybase.io/eralp) on keybase.
  • I have a public key ASANkICEm7fyQR6M_bKgb64xyraKACf0KyBztViHmt_QNAo

To claim this, I am signing this object:

@eralpkaraduman
eralpkaraduman / printStack.swift
Created August 23, 2016 23:57
Printing where the function was called from in swift 2
func someFunction() {
// drops last call because it's the current function call
if let sym = NSThread.callStackSymbols().dropFirst().first {
print(sym)
}
}