Skip to content

Instantly share code, notes, and snippets.

@ap4y
ap4y / qgoverride
Created December 21, 2015 21:23 — forked from timrwilliams/qgoverride
Override QuotaGuard Static Socksify env variable setup with your own socks.conf file
#!/bin/bash
# Script inspired by and derived from Proximo (https://github.com/pirateradio/proximo-stacklet)
# Usage ./qgoverride rails s
if [ "${QUOTAGUARDSTATIC_URL}" == "" ]; then
echo "No QUOTAGUARDSTATIC_URL env variable found. Have you installed QuotaGuard Static?"
echo "If using Heroku:"
echo " heroku addons:add QuotaGuardstatic:test"
echo "If using another platform sign-up at quotaguard.com and follow documentation to manually set variable"
exit 2
@ap4y
ap4y / main.go
Created August 2, 2015 22:40
golang gcm
package main
import (
"fmt"
"log"
"time"
"github.com/mattn/go-xmpp"
)
#!/bin/bash
##
## Usage update_production service [image]
##
## Arguments:
## service: carnival-sidekiq. '-production' will be added automatically
## image: redis:latest. Can be empty, in this case image = service:latest
##
##
FROM debian:jessie
# Install prerequisites
RUN apt-get update
RUN apt-get install -y git ruby imagemagick
# Install bundler
RUN gem install bundler
FROM base/archlinux
# Install prerequisites
RUN pacman -S git ruby imagemagick --noconfirm
# Install bundler
RUN gem install bundler
FROM ubuntu
# Install prerequisites
RUN apt-get update
RUN locale-gen en_US.UTF-8
RUN apt-get install -y build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev git imagemagick
# Install ruby
ADD http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz ruby-2.1.2.tar.gz
RUN tar -xzvf ruby-2.1.2.tar.gz
@ap4y
ap4y / gist:9881152
Created March 30, 2014 22:40
NSPersistenceStoreCoordinator with SQLStore
+ (BOOL)addInSQLStorageWithName:(NSString *)dbFileName error:(NSError **)error {
if (!defaultCoordinator) {
if (error) {
NSDictionary *errorInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"Default coordinator is not registered.", nil)
};
*error = [NSError errorWithDomain:NSCocoaErrorDomain
@ap4y
ap4y / gist:9880944
Last active August 29, 2015 13:57
Ember Data beta 7 embedded records
CarnivalMobile.Message = DS.Model.extend({
title: DS.attr('string'),
notifications: DS.hasMany('notification')
});
CarnivalMobile.MessageSerializer = DS.ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
notifications: { embedded: 'always' }
}
}
@ap4y
ap4y / InvocationLogger.h
Last active December 15, 2015 18:39
Instance method invocation logger
@interface InvocationLogger : NSObject
@property (strong, nonatomic) id interceptedTarget;
@end