Skip to content

Instantly share code, notes, and snippets.

module FormtasticExtensions
module Formtastic
module TextileEditor
def self.included(base)
base.class_eval do
@javascript_included = false
end
end
@zuf
zuf / php_javascript_html_redirect.php
Created September 15, 2010 17:29
Complete PHP + JavaScript + HTML redirect solution
<?php
//
// Complete PHP + JavaScript + HTML redirect solution
//
$url = 'http://www.example.com/';
header("Location: $url"); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript">//<![CDATA[
location.replace("<?php echo $url; ?>");
@zuf
zuf / gist:1106666
Created July 26, 2011 12:43
www to non-www redirect (mod_rewrite)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@zuf
zuf / optimize_images.rb
Created February 3, 2012 09:04
Small ruby script that try to optimize JPEG and PNG images with external tools like jpgcrush or optipng
#!/usr/bin/env ruby
require 'rubygems'
@optimize_image_bin = 'optimize_image_bin' # from google pagespeed sdk
@pngout = 'pngout'
@pngcrush = 'pngcrush'
@optipng = 'optipng'
@advpng = 'advpng'
@zuf
zuf / Gemfile.lock
Created March 27, 2012 14:25
Gemfile for Russian gem issue #34
GIT
remote: https://github.com/tgbyte/twitter-bootstrap-rails.git
revision: ef49b93cb585413b0e2d14e44e50063a0fd58b5c
specs:
twitter-bootstrap-rails (2.0.2.2)
actionpack (>= 3.1)
less-rails (~> 2.1.5)
railties (>= 3.1)
GEM
@zuf
zuf / kdenlive-transition-fixer.rb
Created July 30, 2012 10:38
kdenlive dissolve transition fixer. Prints fixed project xml contents. (See kdenlive bug: http://www.kdenlive.org/mantis/view.php?id=2668)
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
if ARGV.size != 1
$stderr.puts "kdenlive dissolve transition fixer. Prints fixed project xml contents. (See kdenlive bug: http://www.kdenlive.org/mantis/view.php?id=2668)"
$stderr.puts "Usage: #{File.basename $PROGRAM_NAME} <project.kdenlive>"
@zuf
zuf / PKGBUILD
Created October 6, 2012 15:45
PKGBUILD for gnuradio 3.6.2
# Contibutor: [email protected]
# Maintainer: Moritz Fischer <[email protected]>
pkgname=gnuradio
pkgver=3.6.2
pkgrel=1
pkgdesc="free software development toolkit that provides the signal processing runtime and processing blocks to implement software radios using readily-available, low-cost external RF hardware and commodity processors"
arch=('i686' 'x86_64')
license=('GPL')
depends=('fftw' 'python2-numpy' 'boost-libs' 'cppunit' 'swig' 'gsl' 'blas' 'guile' 'libuhd')
makedepends=('boost')
@zuf
zuf / compose_star_trails.rb
Created October 4, 2013 12:52
Helps to create start trails from series of photos. It uses ImageMagick.
#!/usr/bin/env ruby
require 'rubygems'
require 'tmpdir'
@compose_method = 'LightenIntensity'
@processes_count = 4
@intermediate_image_format = "tga"
class Numeric
@zuf
zuf / extract_contour_gps.sh
Created May 20, 2015 10:16
This script extracts GPS data (in GPX format) from ContourGPS camera videos.
#!/usr/bin/env sh
# This script extracts GPS data (in GPX format) from ContourGPS camera videos.
# You need to have ffmpeg, gpsbabel and gnu parallel to run this script.
#
# Please note that *.gpx files in given directory may be overwriten!
#
# Usage: extract_contour_gps.sh <directory_with_movies>
#
@zuf
zuf / after-contourgps-mount.sh
Created July 6, 2015 15:48
Shell script for automated sync mounted to usb action camera to my archive. GUI progress shown through zenity (matedialog) tool. This script was written for usage with udev rules.
#!/usr/bin/bash
# This script uses too much unneeded dependencies (like python for adding some integers). Sorry for that.
# You can clean it for your cases (replace python with bc for example).
# TODO: test rsync version shoud has --info=progress2 option (v3.0.10 or more)
#USER="`whoami`"
CONTOUR_MOUNTPOINT="/run/media/$USER/CONTOUR GPS/DCIM"
CONTOUR_ARCHIVE='/path/to/archive'