Skip to content

Instantly share code, notes, and snippets.

@icleversoft
icleversoft / gist:2479085
Created April 24, 2012 11:56 — forked from matiaskorhonen/gist:420880
Unicorn(RVM) Script file
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@icleversoft
icleversoft / unicorn.rb
Last active October 3, 2015 15:37 — forked from killercup/README.md
Unicorn Config
APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
RAILS_ROOT = APP_ROOT
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
#$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! APP_ROOT
@icleversoft
icleversoft / unicorn
Created April 25, 2012 16:18
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@icleversoft
icleversoft / gist:2497126
Created April 26, 2012 07:22
Sending Apple Push Notifications using C#
int port = 2195;
String hostname = "gateway.sandbox.push.apple.com";
//load certificate
string certificatePath = @"cert.p12";
string certificatePassword = "";
X509Certificate2 clientCertificate = new X509Certificate2(certificatePath, certificatePassword);
X509Certificate2Collection certificatesCollection = new X509Certificate2Collection(clientCertificate);
TcpClient client = new TcpClient(hostname, port);
@icleversoft
icleversoft / iosMacros.h
Last active August 3, 2016 07:01
iOS Macros
// App Information
#define AppName [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]
#define AppVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
#define AppDelegate(type) ((type *)[[UIApplication sharedApplication] delegate])
#define NSAppDelegate(type) ((type *)[[NSApplication sharedApplication] delegate])
#define SharedApp [UIApplication sharedApplication]
#define NSSharedApp [NSApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
@icleversoft
icleversoft / README.md
Created October 12, 2012 11:20 — forked from mloughran/README.md
EventMachine

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

#include <dispatch/dispatch.h>
typedef void (^MHChannelsBlock)(id sender, NSDictionary *dictionary);
/*!
* A "channel" is like a private NSNotificationCenter between just two objects
* (although more are possible).
*
* Instead of making your objects, such as two view controllers, communicate
@icleversoft
icleversoft / rm_tags.sh
Last active December 12, 2015 10:49
shell script for both local and remote tag deletion on a git repo
#!/bin/sh
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
namespace :ubuntu do
desc "Setup Environment"
task :setup_env, :roles => :app do
update_apt_get
install_dev_tools
install_git
install_subversion
install_sqlite3
# Install and setup RVM instead of old Rails stack
#install_rails_stack
@icleversoft
icleversoft / redis.conf
Created March 1, 2013 08:38
Redis configration fiel for ubuntu distributions
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes