Skip to content

Instantly share code, notes, and snippets.

View DerekK19's full-sized avatar

Derek Knight DerekK19

View GitHub Profile
/Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -e test.png -w 1024 -h 1024 test.svg
#!/bin/sh
# Script used in XCode build phase to bring Carthage dependencies up to date
# Will check if the Cartfile is newer than the Cartfile.resolved, and if so
# Will bring the Carthage checkouts up to date
# If the checkouts are newer than the build
# Will bring the build up to date
#
# Derek Knight
# Jun 2016
@DerekK19
DerekK19 / image_generate.sh
Created April 21, 2015 10:06
Convert an image (typically 512x512) to sizes appropriate for iOS apps
#!/bin/bash
# Generate 3 images from the specified one
# takes two parameters"
# The image to be resized
# The new image base name
# The base image size
# Generates:
# A new image at the base size, this will be named <new image base name>.png
# A new image at 2x the base size, this will be named <new image base name>@2x.png
@DerekK19
DerekK19 / unused_images.sh
Created December 19, 2013 04:39
Find unused images in an Xcode project. Install ack first (using brew install ack)
#!/bin/bash
for i in `find . -name "*.png" -o -name "*.jpg"`; do
file=`basename -s .jpg "$i" | xargs basename -s .png | xargs basename -s @2x`
result=`ack -i "$file"`
if [ -z "$result" ]; then
echo "$i"
fi
done
@DerekK19
DerekK19 / gist:6654618
Last active December 23, 2015 15:19
Raspberry Pi development
# List installed packages
dpkg --get-selections
# List the files in a package (e.g php5-gd)
dpkg -L php5-gd
# Update installed packages
sudo apt-get update
# Set up to use Gertboard
@DerekK19
DerekK19 / .bash_profile
Last active December 22, 2015 19:19
OSX .bash_profile file
if [ -f ~/.git-prompt.sh ]; then
source ~/.git-prompt.sh
fi
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
if [ -f ~/.bash-colours ]; then
source ~/.bash-colours
@DerekK19
DerekK19 / .bashrc
Last active December 22, 2015 19:19
OSX .bashrc file
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
PS1="\h:${BRed}\u${White} \W${Black}\$(__git_ps1)${White} $ "
@DerekK19
DerekK19 / gist:6337811
Created August 26, 2013 03:09
Setup RVM to use a different version of Rails
# Assuming you have ruby (say 2.0) installed along with Rails (4.0)
# If you now want to set up Rails 3.2 as well, (for example to connect to SQL Server databses, which Rails 4.0 can't do)
# Set up rvm to use a different gemset (which in this case we will call Rails3.2)
rvm use ruby-2.0.0@Rails3.2 --create
# install Rails 3.2 in that gemset
gem install rails -v 3.2
# list the available rvm gemsets
@DerekK19
DerekK19 / gist:6337090
Created August 26, 2013 00:05
Rails example commands to generate controllers and models
# typically any app would have these controllers
rails generate controller welcome index
# Assume we want a controller for "posts", which would be a group of "post" models
# A post has a title whcih is a string and content, which is a text
rails generate controller posts
rails generate model Post title:string content:text
# Assume we want a controller for "comments" which would be a group of "comment" models
# A comment has a commenter, which is a string, a body which is a text and a post, which is a reference (to a post)
@DerekK19
DerekK19 / gist:6325859
Created August 24, 2013 03:18
Add existing repo to Github
# Create a repo on github. Assume it's called "MyRepo" and your git username is "gitUser"
# set up the current foder to be a git repo
git init
git add .
git commit -m 'Initial commit'
git remote add origin https://github.com/gitUser/MyRepo.git
git pull origin master
git push origin master