Skip to content

Instantly share code, notes, and snippets.

View aghecht's full-sized avatar

Alan Hecht aghecht

View GitHub Profile
@aghecht
aghecht / macmini.md
Created July 30, 2025 21:17 — forked from doop/macmini.md
Installing linux on a 2011 Intel mac mini

Installing linux (Debian) on a 2011 Intel mac mini

Apple have long stopped supporting the mid-2011 mac mini I had sitting in the living room, so rather than contribute to the e-waste problem I decided to stick linux on it. The general consensus seems to be that you should keep macOS bootable to make it easier to deal with any firmware issues down the line, so I wanted to set it up to dual boot. The documentation I was able to find on how to do this seemed scattered or out of date.

There are a number of little wrinkles to this process:

  • macOS quite reasonably assumes it'll be the only thing running on the machine; you need to install a boot manager to let you choose between macOS, linux, or whatever else. I went with rEFInd.
  • Something seems a bit off with the default video setup, such that when I first booted into Debian the screen went blank immediately after enabling kernel modesetting.
  • The mac mini wifi uses a Broadcom chipset with non-free drivers which you have to download separately. I s
@aghecht
aghecht / restore
Created October 16, 2016 20:52 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@aghecht
aghecht / postgres-9.4.sh
Created May 25, 2016 17:53 — forked from carymrobbins/postgres-9.4.sh
Installing PostgreSQL 9.4 on Ubuntu 12.04
sudo apt-get update
sudo apt-get purge postgresql-9.1 postgresql-9.2 postgresql-9.3
# If you don't need postgis, you can probably get away with postgresql-contrib instead.
sudo apt-get install postgresql-client-common postgresql-9.4 postgresql-9.4-postgis-2.1
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@aghecht
aghecht / 0_reuse_code.js
Created April 18, 2014 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// requirejs config in main.js
require.config({
paths: {
jquery: 'components/jquery/jquery',
es5shim: 'components/es5-shim/es5-shim',
es5sham: 'components/es5-shim/es5-sham'
},
map: {
'*': {
'flight/component': 'components/flight/lib/component',

Product management has come up with the idea of allowing website users to leave reviews and ratings for listings. This feedback will be entered similar to how leads are submitted, but the user must enter the following information:

  • name
  • email address
  • phone number
  • rating from 1 to 5
  • optional review

In addition to the above information, a CAPTCHA presenting three different apartment complexes (only one of which is correct) is used in conjunction with the user’s name and phone number to determine whether or not the user actually lived at the listing. After validating and verifying the information, the user gets redirected to a thank you page. After a review is successfully submitted, it will show up as the first entry in the reviews for the listing. Pre-existing “certified resident” reviews will be integrated along with reviews that are submitted through the site. On the search results page, users can sort on rating type or filter on review type and rating. A link on each listing will take the us

@aghecht
aghecht / gist:4287602
Created December 14, 2012 18:43
Set up 32 or 64 bit Centos 6.3 to create a Vagrant base package