Skip to content

Instantly share code, notes, and snippets.

@tjheeta
tjheeta / json_api.ex
Last active August 29, 2015 14:22
First pass for Ecto -> Json API - WIP
defmodule JsonApi do
def filter_struct(obj) do
is_struct?(obj) or (is_list(obj) && is_struct?(Enum.at(obj,0)))
end
def is_struct?(obj) do
is_map(obj) && Map.get(obj, :__struct__) != nil
# ( obj.__struct__ == Ecto.Association.NotLoaded ||
end
def json_api(obj) do
@tjheeta
tjheeta / mysqlex_ecto.diff
Created May 31, 2015 23:50
Convert mariaex to mysqlex for ecto
diff --git a/lib/ecto/adapters/mysql.ex b/lib/ecto/adapters/mysql.ex
index 964aaf2..53d2a07 100644
--- a/lib/ecto/adapters/mysql.ex
+++ b/lib/ecto/adapters/mysql.ex
@@ -3,7 +3,7 @@ defmodule Ecto.Adapters.MySQL do
Adapter module for MySQL.
It handles and pools the connections to the MySQL
- database using `mariaex` with `poolboy`.
+ database using `mysqlex` with `poolboy`.
@tjheeta
tjheeta / gist:654a246d18fea65b2da0
Last active June 21, 2022 08:12
Build OpenSSH RPM for Centos
sudo yum install -y pam-devel
sudo yum install -y rpm-build
sudo yum install -y zlib-devel
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz.asc
# verify the file
# update the pam ssd from the one included on the system
@tjheeta
tjheeta / chef_inventory.py
Created February 15, 2015 04:16
Chef dynamic inventory for Ansible
#!/usr/bin/env python
from __future__ import print_function
import argparse
import json
import chef
import os
import sys
import re
from time import time
@tjheeta
tjheeta / notes
Last active August 29, 2015 14:08
Chef recipe for fixing ssh errors on centos lxc by modifying udev
SSH to the host times out.
Errors seen in /var/log/messages:
Oct 30 14:11:44 mon1 init: tty (/dev/lxc/tty[1-4]) main process (23809) terminated with status 1
Oct 30 14:11:44 mon1 init: tty (/dev/lxc/tty[1-4]) main process ended, respawning
Oct 30 14:11:46 mon1 init: runsvdir main process (133) terminated with status 111
Oct 30 14:11:46 mon1 init: tty (/dev/lxc/tty[1-4]) main process (23812) killed by TERM signal