Skip to content

Instantly share code, notes, and snippets.

View emreberge's full-sized avatar

Emre Berge Ergenekon emreberge

View GitHub Profile
@emreberge
emreberge / Bash-help.sh
Created December 2, 2011 20:25
Bash help function for using with oh-my-zshell
function help(){
bash -c "help $@"
}
@emreberge
emreberge / scp-path.sh
Created January 17, 2012 21:56
Creates a scp compatiable path for the specified file. "my-username@my-hostname:/path/to/specified/file"
#!/usr/bin/env sh
echo "$(whoami)@$(hostname -f):$(cd "$(dirname $1)" && pwd)/$(basename $1)"
@emreberge
emreberge / custom-commands.plist
Last active October 6, 2021 14:18
Custom command on Xcode
<key>Customized</key>
<dict>
<key>Duplicate Current Line Below</key>
<string>selectLine:, copy:, moveRight:, paste:, moveLeft:</string>
<key>Duplicate Current Line Above</key>
<string>selectLine:, copy:, moveToBeginningOfLine:, paste:, moveLeft:</string>
<key>Delete Current Line</key>
<string>selectLine:, deleteBackward:</string>
</dict>
@emreberge
emreberge / replace-files.sh
Created March 30, 2015 20:05
Replaces all files found in specified directory three with their equal named counterparts from the other speicifed directory.
#!/usr/bin/env bash
set -u
set -e
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]:-$0}" )" && pwd )"
script_name="$( basename "${BASH_SOURCE[0]:-$0}" )"
print_usage_and_exit()
{
echo "Replaces all files found in specified directory three with their equal named counterparts from the other speicifed directory."
@emreberge
emreberge / KeyPath.h
Last active September 3, 2015 12:15
Compiler help for keyPaths!
#define KeyPath(keyPath)\
^NSString *(void) {\
__unused __typeof__(keyPath) x;\
return [@#keyPath substringFromIndex:([@#keyPath rangeOfString:@"."].location + 1)];\
}()
@emreberge
emreberge / App permissions.md
Last active October 26, 2020 13:04
Added Spotify to the list
@emreberge
emreberge / gps-coordinates-from-srt-to-mp4.sh
Last active March 9, 2025 08:07
A script that takes the center point of all the latitude, longitude and altitude points in an srt file and adds to the exif meta data of the corresponding mp4 file. Typical use case is for DJI drone movies, which creates an SRT file with meta data for the videos taken. The GPS coordinates is embedded in a format that works with Apple Photos app.
#!/bin/bash
# Use exiftool -"gps*" -n to check coordinates
set -o errexit # Abort on nonzero exit status
set -o nounset # Abort on unbound variable
set -o pipefail # Don't hide errors within pipes
# Global Variables
readonly SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_NAME="$(basename "$0")"