Skip to content

Instantly share code, notes, and snippets.

View melchoy's full-sized avatar
👩‍💻

Melissa Choy melchoy

👩‍💻
View GitHub Profile
@melchoy
melchoy / unifi_ubuntu_jammy.sh
Created September 23, 2023 07:47 — forked from thimslugga/unifi_ubuntu_jammy.sh
Install Ubiquiti UniFi Controller Software v7.x on Ubuntu 22.04 Jammy
#!/usr/bin/env bash
# Install UniFi Controller Software v7.x on Ubuntu 22.04 (Jammy)
#
# - https://help.ui.com/hc/en-us/articles/360012282453
# - https://help.ui.com/hc/en-us/articles/220066768-UniFi-How-to-Install-and-Update-via-APT-on-Debian-or-Ubuntu
# - https://help.ui.com/hc/en-us/articles/360006634094-UniFi-Repairing-Database-Issues-on-the-UniFi-Network-Application
#
# lxc init -p default -p br0 images:ubuntu/22.04 unifi-controller
# lxc init -p default images:ubuntu/22.04 unifi-controller
@melchoy
melchoy / portforwarding.md
Created December 8, 2019 04:49 — forked from kujohn/portforwarding.md
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@melchoy
melchoy / sync-github-to-bitbucket.md
Created November 16, 2019 02:30 — forked from derick-montague/sync-github-to-bitbucket.md
Sync github repo to bitbucket repo

Set up remotes

setup local repo

mkdir myrepository
cd myrepository
git init

add bitbucket remote as "origin"

@melchoy
melchoy / server.md
Created September 14, 2018 00:41 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@melchoy
melchoy / australian-postcodes.sql
Created May 9, 2017 11:39 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@melchoy
melchoy / routes.md
Created April 12, 2017 04:02 — forked from dideler/routes.md
Rails Routes

A summary of the Rails Guides on Routes, plus other tips.

The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

Examples

# Redirects /orders/report to orders#report.
get 'orders/report', to: 'orders#report'
@melchoy
melchoy / ssl_puma.sh
Created January 25, 2017 21:15 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@melchoy
melchoy / gist:6723bb97d9888e73f694
Created December 17, 2015 22:35 — forked from blainerobison/gist:1f1e59c99f5c9a78b93d
wp: Move Category Count Inside Link [WordPress]
/**
* Move Category Post Counts Inside Link
*
* filters wp_list_categories()
*
* @param string $links link html output
* @return string
*/
function prefix_move_category_count( $links ) {
@melchoy
melchoy / install-comodo-ssl-cert-for-nginx.rst
Created December 13, 2015 05:58 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

:: 1) Download srvany.exe from Microsoft Windows 2003 Resource Kit (available free from Microsoft).
:: 2) Copy srvany.exe into the folder where google drive is installed or next to this script file.
:: 3) Run this script as an Administrator
echo off
cls
SET STARTING_DIR=%CD%
SET SCRIPT_DIR=%~dp0