Skip to content

Instantly share code, notes, and snippets.

View mapuo's full-sized avatar

Mario Georgiev mapuo

  • SoftAvail, Inc.
  • Sofia, Bulgaria
View GitHub Profile
@felipedeboni
felipedeboni / CEP.sql
Created August 13, 2013 00:03
Import data from GPBE tables (format as .csv, with ; as delimiter and quotes with ")
/* ===============================================================================================================================
This will get data from GBPE (previously) converted to CSV and:
* Create temporary tables
* Import data from: LOG_LOGRADOURO.csv, LOG_LOCALIDADE.csv, LOG_BAIRRO.csv into the temp tables
* Decrypt CEP column and create a new table with the following fields: cep, logradouro, bairro, cidade, uf, uf_sigla
* Dropping the temp shit
* Update PG Query Builder with an EXPLAIN ANALYZE
This script can be used to update an existing table (with same struct of course)
@bdkosher
bdkosher / FederalHolidays.java
Created March 7, 2014 16:30
Java class for determining the dates of U.S. Federal Holidays, along with Spock test.
package bdkosher.datetime;
import java.util.Calendar;
import static java.util.Calendar.*;
import java.util.Date;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TimeZone;
import java.util.TreeSet;

Running Unifi Controller in systemd-nspawn with cloud-init

This uses Ubuntu's server cloud image as a stateless container to run the UBNT Unifi Controller software. Configuration data is stored in a directory outside the container. Cloud-init is used to automatically set up the container image, so a new version can be dropped in with minimal effort. This should work with pretty much any modern Linux distro with systemd.

Setup

Systemd-nspawn prefers to store its machines on btrfs, so if your /var/lib/machines is not currently btrfs, you should create one and mount it there. Otherwise it will automatically create an image file at /var/lib/machines.raw and mount it.

Create a device