Skip to content

Instantly share code, notes, and snippets.

View Headless Setup of Raspberry Pi Zero W (Raspberry Pi 3 Wireless) (macOS).markdown

#Headless Setup of Raspberry Pi Zero W (Raspberry Pi 3 Wireless) (macOS)

  1. Formatt the Micro SD card - Open a terminal and type 'diskutil list'. Find your card and copy the disk name (For example: /dev/disk4). Format the card with diskutil eraseDisk ExFat temp disk4(Use your disk here)
  2. Download Raspbian - wget
  3. Unmount the SD card - diskutil unmountDisk /dev/disk4 or whatever your disk path is
  4. Mount the Raspbian image to the card - sudo dd if=PATH-TO-RASPBIAN-IMAGE of=/dev/disk4` or whatever your disk path is
  5. Enable SSH on the Pi - cd /volumes && ls. You should see a boot partition from the SD card cd boot && touch ssh
  6. Setup WiFi on the PI - While still in the boot partition of the card type nano wpa_supplicant.conf and enter network={ ssid="YOUR-SSID" psk="YOUR-WIFI-PASSWORD" }
  7. Boot the PI - Unmount the card diskutil unmountDisk /dev/disk4 (or whatever your disk path is) and put it in the
View Setting up Docker Machine on Raspberry

#Setting up Docker Machine on Raspberry PI

  1. SSH into the pi and install docker with curl -sSL | sh (If we let Machine try to install the Docker daemon it will fail.)
  2. Change the OS's ID so Docker Machine won't throw errors. sudo nano /etc/os-release and change the line that says ID=raspbian to ID=debian
  3. From a new terminal window run docker-machine create --driver generic --generic-ip-address YOUR-PIS-IP --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user pi --engine-storage-driver overlay2 MACHINE-NAME
calebbrewer /
Last active May 13, 2021
How to Setup wkhtmltopdf on CentOS 7

How to Setup wkhtmltopdf on CentOS 7

Install Dependencies

yum install fontconfig libXrender libXext xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi freetype libpng zlib libjpeg-turbo

Install wkhtmltopdf

calebbrewer / Stop SELinux from blocking apache external program
Last active Oct 10, 2019
Allow apache to execute an external program through SELinux.
View Stop SELinux from blocking apache external program

Allow apache to execute an external program through SELinux

This is helpful when you don't want to disable SELinux but do want to allow apache to execute an external program. For example wkhtmltopdf. Run the following commands from the terminal. (This has been tested in CentOS 7.)

Allow Exicution

setsebool httpd_execmem on

Change a dirs security context if the program writes to a file

View Contract Killer

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

calebbrewer / deletePendingComments
Created Dec 24, 2013
Deletes all pending comments WordPress from within MySQL
View deletePendingComments
DELETE FROM wp_comments WHERE comment_approved = 0
View Stop SELinux from blocking sendmail
You can check if SELinux is blocking sendmail by running:
/usr/sbin/getsebool httpd_can_sendmail
...which will report:
httpd_can_sendmail --> {on|off}
...and if it is off, you can turn it on using
calebbrewer / ifJesus
Created Jul 14, 2013
If the Gospel where written in PHP this would be the constructor function
View ifJesus
if($believeInAdhereToAndRelyOnJesus == TRUE) {
//Run functions
else {
//Output a message and terminate the current script
View WAMP curl fix
The php_curl.dll file that came with WampServer 2.2 distribution does not work on 64bit systems. You can download a working php_curl.dll file ( from
1. Setup wamp.
2. From wamp icon select PHP > PHP extensions > php_curl (it needs to be checked)
3. Extract php_curl.dll from the zip and copy it to PHP extension directory (mine is c:\wamp\bin\php\php5.3.13\ext)
4. Restart all services from the wamp menu
5. Go to localhost and click phpinfo() link and see that curl is there…
calebbrewer / Deploy With Git
Last active Apr 7, 2020
Manage and deploy a website with Git. I am using Lunux CentOS for my server.
View Deploy With Git
Video on this Gist:
#Initialize a bare repo on the webserver. This would preferably be outside of your public website dir but if you are on a shared host you may not have that option. I like to make a folder just outside of the live folder called git. So for me it would look like this…
$ cd /var/www
$ mkdir git && cd git
$ git init –-bare
#Now you need to create a post-receive hook that will check out the latest tree from the Git repo you just setup into the /var/www/html folder where you want your website to be. You can make this whatever folder you want your code to end up in.
#This will create a file called post-receive in the hooks dir of the git repo.