Skip to content

Instantly share code, notes, and snippets.

View zeroasterisk's full-sized avatar

alan blount zeroasterisk

View GitHub Profile
@zeroasterisk
zeroasterisk / mime.types
Created May 7, 2013 19:42
nginx config: /etc/nginx/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;
@zeroasterisk
zeroasterisk / buildPhantomJSAsLinux-inDocker.sh
Created September 21, 2016 19:04
Build a node lambda function for
#!/bin/bash
# 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...
# https://github.com/sindresorhus/pageres/issues/275
#
# Easiest solution, download inside a docker, running on linux
#
# This script should be run from within the docker container
#
@zeroasterisk
zeroasterisk / spec.json
Created March 22, 2023 01:40
Radar Chart Vega spec from Tue Mar 21 2023
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A radar chart example, showing multiple dimensions in a radial layout.",
"width": 400,
"height": 400,
"padding": 40,
"autosize": {"type": "none", "contains": "padding"},
"signals": [{"name": "radius", "update": "width / 2"}],
"data": [
{
@zeroasterisk
zeroasterisk / confirm.sh
Created August 31, 2011 14:04
confirm.sh a simple way to add confirmation to bash scripts
# ======================================================================
#
# @link http://wuhrr.wordpress.com/2010/01/13/adding-confirmation-to-bash/#comment-3540
#
# 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
zeroasterisk / user.ex
Last active August 4, 2021 03:22
Example Elixir+Ecto schema to mirror a Mongo DB with complicated data structures
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
zeroasterisk / cleanup_uft8_class.php
Created April 30, 2012 15:15
A PHP class to cleanup strings to be UTF8
<?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
zeroasterisk / .zshrc
Created August 23, 2011 18:09
~/.zshrc for Oh My ZSH (alan)
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# 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.
#ZSH_THEME="alanpeabody"
#ZSH_THEME="dieter"
#ZSH_THEME="eastwood"
@zeroasterisk
zeroasterisk / newrelic-daemon.log
Last active November 12, 2019 08:09
/var/log/newrelic/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):
/usr/bin/newrelic-daemon(nr_signal_tracer_common+0xc0)[0x8080d70]
/usr/bin/newrelic-daemon[0x8082732]
[0xb77d7400]
/usr/bin/newrelic-daemon(lh_insert+0x121)[0x8120d36]
/usr/bin/newrelic-daemon[0x80fd09c]
/usr/bin/newrelic-daemon[0x80fd77c]
/usr/bin/newrelic-daemon(ENGINE_new+0x6f)[0x81153d8]
@zeroasterisk
zeroasterisk / client_application.js
Last active September 22, 2018 17:15
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…
// 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
zeroasterisk / wkb.js
Created November 2, 2016 20:17
import poly data from taradel
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');