Skip to content

Instantly share code, notes, and snippets.

View girasquid's full-sized avatar
🦐

Luke Hutscal girasquid

🦐
View GitHub Profile

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It doesn't! From my testing, the controller pairs with the last machine it was CONNECTED VIA A USB CABLE.

Here are the real Steps:

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
// Start fading in slowly...
jQuery('.alert').fadeIn("fast", function() {
// This callback gets run once the fadeIn has finished.
jQuery('.alert').fadeOut("slow");
});
@girasquid
girasquid / gist:3427762
Created August 22, 2012 17:29 — forked from mduheaume/gist:3409226
compressing a bunch of id's to construct a url
import random
import string
import base64
import zlib
import bz2
random_ids = [''.join([random.choice(string.ascii_lowercase) for x in range(8)]) for n in range(1000)]
long_string = ','.join(random_ids)
@girasquid
girasquid / gist:2952168
Created June 19, 2012 03:39 — forked from TimFletcher/gist:2948882
Django View
from django.shortcuts import render
def some_view(request, template_name='path/to/template.html', extra_context={}):
context = extra_context.copy()
# Request remote page and parse it
foo = 'Some template variable'
context['foo'] = foo
return render(request, template_name, context)
@girasquid
girasquid / clunky.py
Created November 24, 2011 23:16 — forked from kylefox/clunky.py
class MyThing(object):
def save(self, *args, **kwargs):
# If only I could `my_kwarg = kwargs.delete('my_kwarg')
my_kwarg = kwargs.pop('my_kwarg', False)
print "did some things"
# result = super(SpecialThing, self).save(*args, **kwargs)
if my_kwarg:
print "did other things, because of the kwarg"
# self.do_more_stuff()
@girasquid
girasquid / ubuntu_setup.sh
Created September 24, 2011 17:30 — forked from kylefox/ubuntu_setup.sh
Automated setup for a Ubuntu server with git, ruby, rvm, nginx.
#!/usr/bin/env bash
# ----------------------------------------------------
#
# Automated setup for a Ubuntu server with git, ruby, rvm, nginx.
# (Used at Carbonmade)
#
# Usage:
# - SCP this file to your server: scp ubuntu_setup.sh you@server:~
# - Make it executable: chmod +x ubuntu_setup.sh
# - Run it: bash ubuntu_setup.sh
/*
* Sweet sugar for jQuery's $.data API.
* http://yehudakatz.com/2009/04/20/evented-programming-with-jquery/
*
* Instead of this:
*
* $("#foo").data("foo"); // Get foo
* $("#foo").data("foo", 'bar'); // Set foo
*
* Do this:
"""
The HOSTMAP variable is a dictionary of lists. The keys represent
roles of a server, the values represent the hostnames of machines that
fill those roles. If you are reading this, you likely know what you're
doing. If you don't know what you're doing, you probably want to put
your hostname into local_dev. Ensure it has a comma at the end, and
the hostname is a string.
You can get your hostname by typing `hostname` into a terminal.
#!/bin/sh
# Install ImageMagick on Snow Leopard: by kain, improved by mislav and samsoffes
# http://www.icoretech.org/2009/08/install-imagemagick-in-leopard-snow-leopard/
# Work with 64bit kernel mode
set -e
PREFIX=/usr/local
# Passenger users: amend your Apache global configuration with the following directive
# SetEnv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin