layout | title | description | tags | ||
---|---|---|---|---|---|
default |
SQL Style Guide |
A guide to writing clean, clear, and consistent SQL. |
|
Containerized setup for downloading and sharing media.
- https://www.giganews.com -- NZB access +VPN
- https://nzbfinder.ws/ -- NZB search
Everything is root
-owned and all services run as root
. Anything other than
# A convenient script for Elixir golfing. | |
# Provide your code and some test cases. Then run this file, e.g. "elixir caddy.exs". | |
# Outputs your character length and test results. | |
# Text input, text output and return values are all handled. | |
# | |
# By Henrik Nyh (http://henrik.nyh.se) under the MIT license. | |
ExUnit.start | |
defmodule Caddy.Example do |
require 'net/http' | |
require 'json' | |
require 'uri' | |
@token = '' | |
def list_files | |
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago | |
params = { | |
token: @token, |
It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time
class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime
steps in:
>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
TL;DR
Create a backup:
pg_dumpall > mybackup.sql
Perform the upgrade:
sudo pg_dropcluster 9.4 main --stop
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.
We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.
It should be generic enough to work on any elixir app using mix.
If you have a elixir_buildpack.config
, then enable that section in the build script to keep versions in sync!
2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.
# Print statistics | |
failures = Resque::Failure.all(0, -1).each_with_index.map { |ex, i| ex['id'] = i; ex }; nil | |
fbe = Hash.new { |h, k| h[k] = Array.new } | |
fbc = Hash.new { |h, k| h[k] = Array.new } | |
failures.each { |ex| fbe[ex['exception']] << ex; fbc[ex['payload']['class']] << ex }; nil | |
puts fbe.map { |e,jj| [e, jj.size] }.inspect | |
puts fbc.map { |e,jj| [e, jj.size] }.inspect | |
# Dump failures as JSON | |
failures = Resque::Failure.all(0, -1).each_with_index.map { |ex, i| ex['id'] = i; ex }; nil |
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
sudo su -l postgres | |
psql -d template1 -p 5433 | |
CREATE EXTENSION IF NOT EXISTS hstore; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
service postgresql stop | |
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf" |