Skip to content

Instantly share code, notes, and snippets.

View udaykadaboina's full-sized avatar
🎯
Focusing

Uday Kadaboina udaykadaboina

🎯
Focusing
View GitHub Profile
@coldnebo
coldnebo / turbulence.m
Last active August 29, 2015 14:24
script for extracting the turbulence around a photo of a building.
close all
% read the building picture
I1 = imread('IMG_5380.JPG');
% correct the rotation
I2 = imrotate(I1, -90);
% crop it to the area of interest
I3 = imcrop(I2,[378.5 0.5 948 814]);
% focus on an roi to isolate just the sky from the building...
rp = [0 815;70 815;251 435;570 363;949 657;949 0;0 0];
@seabre
seabre / passenger_standalone_production.sh
Created December 15, 2011 21:42
Start Passenger Standalone in Production Mode
#For some reason, this took forever to figure out...
passenger start -a 127.0.0.1 -p 3000 -d -e production
@udaykadaboina
udaykadaboina / launch_sublime_from_terminal.markdown
Last active January 8, 2016 16:30 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Modified the original doc. for Sublime Text 3!

Launch Sublime Text 3 from the Mac OS X Terminal

Sublime Text 3 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/3/osx_command_line.html

Installation

@lucaspiller
lucaspiller / gist:7371780
Created November 8, 2013 14:29
GitHub.app git and Homebrew git conflict
$ brew install git
zsh: correct 'git' to '.git' [nyae]? n
Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-1.8.4.2.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/git-1.8.4.2.mavericks.bottle.tar.gz
==> Pouring git-1.8.4.2.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
require 'fiddle'
require 'minitest/autorun'
class RubyVM
class InstructionSequence
address = Fiddle::Handle::DEFAULT['rb_iseq_load']
func = Fiddle::Function.new(address, [Fiddle::TYPE_VOIDP] * 3, Fiddle::TYPE_VOIDP)
define_singleton_method(:load) do |data, parent = nil, opt = nil|
func.call(Fiddle.dlwrap(data), parent, opt).to_value
@harley
harley / gist:b3d55b8b622b8fd7ba1c
Created July 29, 2015 07:18
remove merged branches on remote origin, handling feature/blah branches
git branch -r --merged | grep -vw "master" | grep -vw "HEAD" | grep -vw "develop" | cut -d "/" -f2 -f3| xargs -p -I {} git push origin :{}
@madzhuga
madzhuga / Gemfile
Created April 5, 2015 18:25
Minimal Rails 4.2 application
source 'https://rubygems.org'
gem 'thin'
gem 'rails', '4.2.0'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
@dmshvetsov
dmshvetsov / seed.rb
Last active June 1, 2019 15:29
How to seed your database with JSON/YAML. Source http://snippets.aktagon.com
json = ActiveSupport::JSON.decode(File.read('db/seeds/countries.json'))
json.each do |a|
Country.create!(a['country'], without_protection: true)
end
@simonrobson
simonrobson / gist:6137148
Last active July 29, 2019 01:28
Disable asset pipeline in Rails 4
Comment in Gemfile:
# Use SCSS for stylesheets
# gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
# gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
# gem 'coffee-rails', '~> 4.0.0'
@akshaymohite
akshaymohite / luhn-algorithm-to-validate-card-number.rb
Last active October 10, 2019 22:14
Luhn's Algorithm to validate card numbers
number = "314143525252"
sum = 0
number.reverse.split("").each_slice(2) do |x,y|
sum += x.to_i + (2*y.to_i).divmod(10).sum
end
p sum%10 == 0 ? 'valid card number' : 'invalid card number'