Skip to content

Instantly share code, notes, and snippets.

View saurabheights's full-sized avatar

Saurabh Khanduja saurabheights

View GitHub Profile
@saurabheights
saurabheights / .gitignore
Created January 28, 2017 05:35 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@saurabheights
saurabheights / pre-push.sh
Created March 15, 2017 12:22 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

# Convert gif to video. The best/right way to serve GIF in today's date.
ffmpeg -f gif -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -preset veryslow output.mp4
# Create a video from slideshow with framerate 1 frame per 2 seconds.
ffmpeg -framerate 1/2 -i %d_1x1.jpeg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4
# Encode with same video but different audio
ffmpeg -i input.mp4 -vcodec copy -acodec {mp2,mp3,aac,ac3} output-vcodec_h264-acodec_mp2.mp4
# Encode with video as h264 and audio as aac with crf
# Thanks to http://ryanstutorials.net/bash-scripting-tutorial
# Original Author - Ryan Chadwick.
# If you are a complete newbie, the website will provide you much more knowledge, so please do check out his website.
# This is only a personal cheatsheet and there is a good chance I have skipped over some trivial stuff.
#Bash is case sensitive, so lower case variables are different the upper case variables.
#Path
echo $PATH
@saurabheights
saurabheights / QuickSystemSetup.sh
Last active April 17, 2024 22:11
A gist to quickly setup ubuntu for your needs.
# Disable need to provide password for sudo. use only if you can lock system when afk.
sudo visudo
# Add below line to the end of file, where replace $USER with your system username.
$USER ALL=(ALL) NOPASSWD: ALL
# Install fzf for better reverse search
sudo apt install fzf
cat /usr/share/doc/fzf/README.Debian # For how to integrate with your shell
echo "source /usr/share/doc/fzf/examples/completion.bash" » ~/.bashrc

Start the db

Open PgAdmin III from dash
sudo /usr/sbin/service postgresql start
reconnect from PGAdmin using password

PostGIS Documentation

View installed and available extensions

SELECT * FROM pg_extension
SELECT * FROM pg_available_extensions

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Anaconda]
"Icon"="%USERPROFILE%\\Anaconda3\\Menu\\Iconleak-Atrous-Console.ico"
@="Open Anaconda Prompt here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Anaconda\command]
@="C:\\Users\\bdforbes\\Anaconda3\\pythonw.exe C:\\Users\\bdforbes\\Anaconda3\\cwp2.py C:\\Users\\bdforbes\\Anaconda3 \"%V\" cmd.exe \"/K\" C:\\Users\\bdforbes\\Anaconda3\\Scripts\\activate.bat C:\\Users\\bdforbes\\Anaconda3"
[HKEY_CLASSES_ROOT\Directory\shell\Anaconda]
def transformPixelBetweenCameras(pixelLocationInSrcFrame,
depth,
srcCameraMatrix,
srcCameraDistortionCoefficients,
srcCameraRVec,
srcCameraTVec,
dstCameraMatrix,
dstCameraDistortionCoefficients,
dstCameraRVec,
dstCameraTVec):
@saurabheights
saurabheights / bashrc
Last active January 24, 2020 12:31
Useful bashrc content
# Bindings for deleting word backward and forward using CTRL-Backspace and Ctrl-Del.
# Note that backspace will respect delimiters as _, which are not respected by Ctrl+w. To be put in bashrc.
bind '"\C-h":backward-kill-word'
bind '"\e[3;5~":kill-word'
# Bashrc aliases. sbp - p is for bash profile.
alias sbp="source ~/.bashrc"
alias obp="subl ~/.bashrc"
alias obh="subl ~/.bash_history"
alias vbp="vi ~/.bash_profile"