Skip to content

Instantly share code, notes, and snippets.

View dejanr's full-sized avatar

Dejan Ranisavljevic dejanr

View GitHub Profile
@dejanr
dejanr / macspoof.sh
Created June 3, 2011 20:31 — forked from latentflip/macspoof.sh
MAC Spoof on OSX
# Do these once
ifconfig en1 | grep ether > .macaddress #Save your real mac address somewhere
# Alias the airport adapter
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
# Then each time you want to change MAC address:
airport -z #disconnect but don't turn off the airport
sudo ifconfig en1 ether 00:00:00:00:00:00 #set new mac address (perhaps just increment your old one)
ifconfig en1 | grep ether #check it's actually changed
@dejanr
dejanr / vm.sh
Created November 10, 2011 15:55 — forked from un33k/vm.sh
Script to run Linux vmware image on Mac OSX in headless mode
# Start and stop headless VMs
# put this on your path as save it as vm or vm.sh.
# no need to turn your vmware on when running on Mac
# just run as vm start and it will list all the available vm images.
# then choose which one you want to start. perfect for running Linux under OSX
# in headless mode for development
# Note:, some of this script is from gist (72638254422dc741b299)
# Some rework and enhancement to make it work better and handle windows
#!/bin/bash
@dejanr
dejanr / gist:3187567
Created July 27, 2012 11:50
Clean Install – Mountain Lion OS X 10.8 DP3
@dejanr
dejanr / API.md
Created August 22, 2012 21:44 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@dejanr
dejanr / Cakefile
Created September 10, 2012 13:35 — forked from paulbjensen/Cakefile
A CoffeeScript Cakefile to generate a control deploy.coffee file for your application
fs = require 'fs'
control = require 'control'
task = control.task
task "deploy_script", "Creates a deployment script for your application", ->
appName = "appName"
serverEnvironment = "staging"
serverAddress = "myserver.com"
sshUsername = "app"
startCommand = "/etc/init.d/#{appName} start"
@dejanr
dejanr / gist:4714330
Created February 5, 2013 13:04
Installing pear on OSX Mountain Lion
  sudo cp /private/etc/php.ini.default /private/etc/php.ini
  sudo php /usr/lib/php/install-pear-nozlib.phar
  pear config-set php_ini /private/etc/php.ini
  pecl config-set php_ini /private/etc/php.ini
  sudo pear upgrade-all
@dejanr
dejanr / gist:5009036
Last active December 14, 2015 01:49
Rasspery pi resize openelec storage partition
cd /
touch /var/lock/xbmc.disabled
killall -9 xbmc.bin (XBMC will Close)
umount /storage
parted /dev/mmcblk0
unit s
p (make note of starting sector of partition 2)
rm 2
mkpart primary 258048 -1 (258048 is the starting sector of partition 2 you noted down earlier, add a space and -1)
quit parted
@dejanr
dejanr / gist:5026913
Last active December 14, 2015 04:18
Hack for image load
// cached images don't fire load sometimes, so we reset src.
// this is DOM Node
if (this.complete || this.complete === undefined){
var src = this.src;
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
// data uri bypasses webkit log warning (thx doug jones)
this.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
this.src = src;
}
@dejanr
dejanr / osx php-fpm plist
Last active December 17, 2015 18:59
OSX php-fpm plist
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.php.php-fpm</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/php-fpm</string>
<string>--fpm-config</string>
<string>/usr/local/etc/php/5.4/php-fpm.conf</string>
@dejanr
dejanr / app.js
Created May 30, 2013 09:44 — forked from johnkpaul/app.js
//in your application, rather than using window.location to get the current url
App.getLocation = function(){
return window.location.protocol + '//' + window.location.host
+ '/' + Backbone.history.options.root + Backbone.history.getFragment()
}