Skip to content

Instantly share code, notes, and snippets.

View amokan's full-sized avatar

Adam Mokan amokan

  • Grain
  • Chandler, Arizona
  • 08:10 (UTC -07:00)
View GitHub Profile
@amokan
amokan / README.md
Last active August 29, 2015 14:22
Ruby script to fix ember-cli-blanket lcov.info for code-climate

Ruby script to fix ember-cli-blanket lcov.info for code-climate

Replace <app name here> with your ember-cli app name

I'm currently running this script as a post-build step during my CI process and it is working well.

My blanket-options file has the cliOptions set to the following:

cliOptions: {
@amokan
amokan / mozzi_firmware
Created May 7, 2015 05:15
Mozmo Firmata/Processing Test
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please clink on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/
@amokan
amokan / Vagrantfile
Last active August 29, 2015 14:20
Vagrantfile that runs NSQ in a vagrant VM under docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_NAME = ENV['BOX_NAME'] || 'phusion-open-ubuntu-14.04-amd64'
BOX_URI = ENV['BOX_URI'] || 'https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box'
VMWARE_BOX_URI = ENV['BOX_URI'] || 'https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vmwarefusion.box'
AWS_REGION = ENV['AWS_REGION']
AWS_AMI = ENV['AWS_AMI']
APPS = '/mnt/apps'
@amokan
amokan / gist:d37cd34b91f9eefdc52e
Created May 6, 2015 19:15
firmata test with pressure sensor
import org.firmata.*;
import cc.arduino.*;
import processing.serial.*;
Arduino arduino;
int val = 0;
int currX = 0;
void setup() {
### Keybase proof
I hereby claim:
* I am amokan on github.
* I am adammokan (https://keybase.io/adammokan) on keybase.
* I have a public key whose fingerprint is E59B 094F D816 6F54 786E D943 FAA4 B4B3 6EEE 2EA5
To claim this, I am signing this object:
@amokan
amokan / README.md
Created August 17, 2014 23:20
setLED function

Calling setLED from the existing readADC() function where selector changes are detected. Clearly my port settings are wayyyy off.

if ( ( s | selector ) & 0x20 )
{
    int lastSelector = selector;
    selector = s >> 6;
    selector = selector < 15 ? selector : 15;
    if ( selector != lastSelector )
 {
@amokan
amokan / README.md
Last active December 9, 2019 19:11
Expert Sleepers Disting simple example of audio processing

Some really basic examples of audio processing code for the Expert Sleepers Disting eurorack module.

You can find the base repo for a blank audio passthrough project at https://github.com/expertsleepersltd/disting

You will need to have a 'PICKit 3' USB programmer and the MPLAB IDE (free Microchip dev tools) installed. I grabbed my PICKit from Mouser a while ago and it should be easy to find, wherever you are.

If you want to reflash the stock firmware, you can download that from Expert Sleepers here - http://www.expert-sleepers.co.uk/downloads/firmware/disting_firmware_1_0.zip

Note that the stock firmware is already compiled, so you'll just want to flash it using the 'mplab_ipe' tool.

@amokan
amokan / README.md
Last active August 29, 2015 14:02
inject-something.js

Steps to reproduce problem with ember-cli v0.0.32

  • Create a new project - ember new foo-app
  • Verify it runs/builds - ember server
  • Add inject-something.js into app/initializers
  • Try to run/build again - ember server
  • You should get a Error: Line 3: Unexpected token : output

Obviously the initializer above does nothing, but something changed between v0.0.28/29 and v0.0.32 related to this as all of my initializers cause build problems.

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

#!/usr/bin/env knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it: