Skip to content

Instantly share code, notes, and snippets.


alan blount zeroasterisk

View GitHub Profile
zeroasterisk /
Created Aug 31, 2011 a simple way to add confirmation to bash scripts
# ======================================================================
# @link
# Function: confirm
# Asks the user to confirm an action, If the user does not answer yes,
# then the script will immediately exit.
# Parameters:
# $@ - The confirmation message
zeroasterisk / mime.types
Created May 7, 2013
nginx config: /etc/nginx/mime.types
View mime.types
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
# If you are developing on OSX on Windows
# but you want to run on linux - or in docker - or on AWS Lambda
# PhantomJS must be the binary for that OS...
# Easiest solution, download inside a docker, running on linux
# This script should be run from within the docker container
zeroasterisk / user.ex
Last active Aug 4, 2021
Example Elixir+Ecto schema to mirror a Mongo DB with complicated data structures
View user.ex
defmodule Eltoroportal.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
alias Eltoroportal.Accounts.User
@primary_key {:_id, :string, autogenerate: false}
schema "users" do
field :username, :string
# field :created, :date # <-- ? mongo translation?
zeroasterisk / cleanup_uft8_class.php
Created Apr 30, 2012
A PHP class to cleanup strings to be UTF8
View cleanup_uft8_class.php
/* Standardized data cleanup helper class */
class Cleanup {
* Make a string into UTF8 compliant... cleans funcky input characters
* @param mixed $str
* @return mixed $str
static function makeUTF8($str) {
if (is_array($str)) {
zeroasterisk / .zshrc
Created Aug 23, 2011
~/.zshrc for Oh My ZSH (alan)
View .zshrc
# Path to your oh-my-zsh configuration.
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
zeroasterisk / newrelic-daemon.log
Last active Nov 12, 2019
View newrelic-daemon.log
==> /var/log/newrelic/newrelic-daemon.log <==
Received signal 11: segmentation violation
fatal signal (SIGSEGV, SIGFPE, SIGILL, SIGBUS, ...) - stack dump follows (code=0x807d240 data=0x82f7420 bss=0x82e7334):
zeroasterisk / client_application.js
Last active Sep 22, 2018
MeteorJS code for attaching PhoneGap events, and doing things inside MeteorJS. note: as of now, I'm loading cordova via an AJAX request because it was complaining on direct compile (js bugs in console)... I may keep working on getting it to load with the site/app directly, but the rest of the attached events would remain the same, just without t…
View client_application.js
// initialize as soon as the DOM is ready
Session.set('CordovaLoaded', false);
Meteor.startup(function() {
console.log('cordova loading');
// delay loading of cordova until after DOM is ready
// determine WHICH cordova to load
var cordovajspath = '/cordova-2.6.0.js';
if (navigator.userAgent.match(/(iPad|iPhone|iOS)/) != null) {
cordovajspath = '/cordova-2.6.0-ios.js';
} else if (navigator.userAgent.match(/(Android)/) != null) {
zeroasterisk / wkb.js
Created Nov 2, 2016
import poly data from taradel
View wkb.js
var Buffer = require('buffer').Buffer;
var wkx = require('wkx');
function convertHex(hexInput) {
var wkbBuffer = new Buffer(hexInput.slice(2), 'hex');
var geometry = wkx.Geometry.parse(wkbBuffer);
return geometry.toGeoJSON();
function convertTwkb(hexInput) {
var wkbBuffer = new Buffer(hexInput.slice(2), 'hex');
zeroasterisk / DockerfileForBundle
Created Jul 29, 2016
Meteor build -> Docker (custom image, from bundle)
View DockerfileForBundle
FROM node:4.4.7-slim
MAINTAINER Alan Blount <>
RUN npm install -g npm@3 pm2 \
&& npm cache clear
# TODO: remove when is fixed
RUN cd $(npm root -g)/npm \
&& npm install fs-extra \
&& sed -i -e s/graceful-fs/fs-extra/ -e s/fs\.rename/fs.move/ ./lib/utils/rename.js