Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
j-mcnally / SomeStomplet.rb
Last active November 7, 2022 17:37
Simple stomp authentication over websockets
require 'torquebox-stomp'
class SomeStomplet
def initialize()
@pending_subscribers = {}
@subscribers = {}
end
@j-mcnally
j-mcnally / gist:708584c913e41dd208c1
Last active November 28, 2019 13:15
Install Adobe Flash Builder 4.6 in Ubuntu / Linux Mint / Maybe others?

Install wine

apt-get install wine

Install wine tricks

apt-get install winetricks

Set wine to run in 32-bit mode (Append the following lines to .[bash|zsh]rc)

@j-mcnally
j-mcnally / function.json
Last active July 24, 2019 17:20
Monitor Queue Stats in Azure via Azure Functions
{
"disabled": false,
"scriptFile": "../dist/CheckQueues/index.js",
"bindings": [
{
"schedule": "*/15 * * * * *",
"name": "snapshotSidekiqQueues",
"type": "timerTrigger",
"direction": "in"
}
import _fetch from 'fetch'
import Config from '../config/environment';
import Ember from 'ember'
export default Ember.Service.extend({
session: Ember.inject.service('session'),
fetch(url, options={}) {
return new Promise((resolve, reject) => {
this.get('session').authorize('authorizer:devise', (headerName, headerContent) => {
options = Object.assign({headers: {}}, options)
@j-mcnally
j-mcnally / upgrade_container.sh
Last active June 15, 2018 10:51
Container Reload Script
#!/bin/bash
docker pull user/myrepo && \
docker rm -f myapp && \
docker run -d -p 80:80 -e RAILS_ENV=production --env-file=/opt/utils/deps/web.envfile --name=myapp --link=postgres:postgres --link=redis:redis user/myrepo
@j-mcnally
j-mcnally / docker.sh
Created September 7, 2017 20:44
Install docker on ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates
sudo apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-cache policy docker-engine
@j-mcnally
j-mcnally / gist:83cfac1a7ae1ba6e46f7
Last active April 14, 2017 14:59
OSX 10.10 (Yosemite): Dev Notes

Install xcode 6.0beta from DMG

Install 10.10 command line tools from DMG

Both available at developer.apple.com

Brew installs fine from source via brew.sh

Compilains it can't find a compiler, not sure what fixed this but i did both

import { Component, h, prop } from 'skatejs';
const React = { createElement: h };
const sym = Symbol();
class WaitlistedForm extends Component {
static get is(){ return 'waitlisted-form' }
static get props () {
return {
@j-mcnally
j-mcnally / README.md
Last active January 24, 2017 10:45
Sample ElasticBeanstalk Config for Rails 3 on Puma and Using a bundle / gems cached on s3 for faster scaling.

Quick / Cached Bundles on ElasticBeanstalk

Bonus, support Rack 1.4.5 with puma for Rails 3 apps

Basically we bundle install on one box, upload the result to a dedicated s3 bucked and then other servers/nodes can download the gems and save a ton of time compiling them.

I can not stress enough how the bucked should be dedicated as it will often remove all the files in the bucket to clear the cache / do a new gem build each month incase changes are made to backing ami / software, you can adjust the prefix to clear the bundle "cache key" more frequently by appending more date modifiers such as day or hour if you run into issues.

Note: You can remove 14downgradepuma if your app runs on Rails 4

@j-mcnally
j-mcnally / Caddyfile
Created January 14, 2016 20:02
Caddyfile - Example
config_server "https://etcd.local:2379"
service users {
endpoint: "/users",
proxy: "{{services.users.ip}}:{{services.users.port}}"
}
# In this example 'services.users' would be a directory with a json key for every user service container / application.
# Using this we could template the proxy and any other information in the services block, and it would just work with caddy.