Skip to content

Instantly share code, notes, and snippets.

View speed-of-light's full-sized avatar

Speed of Light speed-of-light

View GitHub Profile
@speed-of-light
speed-of-light / all-templates.html
Created December 5, 2013 14:06 — forked from vojtajina/all-templates.html
angularjs templates
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@speed-of-light
speed-of-light / installer.sh
Last active January 1, 2016 02:19
package installation
# install networkx
sudo apt-get install libgraphviz-dev graphviz
pip install pygraphviz
pip install networkx
# install gsl for rb-gsl 1.15.3
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
tar xvzf gsl-1.15.tar.gz
cd gsl-1.15
./configure
@speed-of-light
speed-of-light / sidekiq.rb
Created January 22, 2014 18:07 — forked from hayeah/sidekiq.rb
sidekiq runners
# adapted from bin/sidekiq
# to invoke, run: zeus runner sidekiq.rb
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse
cli.run
rescue => e
@speed-of-light
speed-of-light / custom_plan.rb
Created January 22, 2014 18:08 — forked from tmaier/custom_plan.rb
zeus files
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def sidekiq
# Based on bin/sidekiq
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse
@speed-of-light
speed-of-light / namespace.rake
Created January 26, 2014 17:52 — forked from wrburgess/namespace.rake
rails seeds templates
namespace :project_name do
require 'csv'
desc 'Migrate previous user database'
task :migrate_users => [:environment] do
input = ''
STDOUT.puts 'Seed with previous users?'
input = STDIN.gets.chomp
if input == 'y'
puts 'Executing tasks...'
/**
* Setup Module with `highlight` filter
*/
var JekyllApp = angular.module('JekyllApp', [], function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(false);
});
JekyllApp.filter('highlight', function () {
return function (text, filter) {
@speed-of-light
speed-of-light / tmux.md
Last active August 29, 2015 13:56 — forked from andreyvit/tmux.md
Tmux cheat sheets

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

module Foo
def self.included base
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
def bar1
'bar1'
end
# -*- coding: utf-8 -*-
# An pure python implemetation of Dynamic Time Warpping
# http://en.wikipedia.org/wiki/Dynamic_time_warping
class Dtw(object):
def __init__(self, seq1, seq2, distance_func=None):
'''
seq1, seq2 are two lists,
distance_func is a function for calculating