Skip to content

Instantly share code, notes, and snippets.

View Raven24's full-sized avatar

Florian Staudacher Raven24

  • Self-employed
  • Vienna, Austria
  • X @raven24
View GitHub Profile
@Raven24
Raven24 / gist:1864992
Created February 19, 2012 18:27
Photos page grid layout
var contW = 704;
var hMargin = 8;
var maxW = contW - (4 * hMargin);
var hmaxW = maxW/2;
var qmaxW = maxW/4;
$('#main_stream div.photo').each(function(i,elm){
var p = $(elm);
var i = p.find('img');
@Raven24
Raven24 / bundle_gems_overview_table.rb
Created February 23, 2012 16:24 — forked from groovehunter/bundle_gems_overview_table
Display table with all gems in a bundle, each with ie. summary and description, render in MediaWiki table
require "rubygems"
require "bundler"
dia = '/home/florian/src/diaspora'
Dir.chdir dia
def allm obj
obj.methods.sort.each { |m|
puts m
}
@Raven24
Raven24 / ipinfo.sh
Created July 29, 2012 22:25
IP address, MAC address and device name with sed
#!/bin/bash
ifconfig -a | grep -A 3 ^eth | sed -n -e '
# add first line to hold space
1h
# add all other lines to hold space
1!H
${
# write hold space to pattern space
g
@Raven24
Raven24 / lib..ti_test_case.php
Created August 11, 2012 23:24
make cakephp unit testing useable
<?php
App::import('Lib', 'TiTestFixture');
/**
* do some magic to make testing more fun
* @author Florian Staudacher
*/
abstract class TiTestCase extends CakeTestCase {
@Raven24
Raven24 / Gemfile
Created September 14, 2012 17:53
website screenshot and comparison generator
source 'http://rubygems.org'
gem 'selenium-webdriver'
gem 'rmagick'
@Raven24
Raven24 / no_root.sh
Created October 22, 2012 08:43
root inhibition
#!/usr/bin/env sh
# Don't allow a given command to be run as root.
# This script will output an error message, in case the current
# user is identified as root (also works in case of 'sudo')
# do we have color ?
case "$TERM" in
xterm*|rxvt*)
read -r red RED blue BLUE cyan CYAN NC <<EOF
@Raven24
Raven24 / style.js
Created November 13, 2012 16:20
D* wiki style
/**
-----------------------------------------------------------------------------
### NOTICE -- This gist is obsolete!
If you still want to try out the style, just sign into the wiki, go to
your user preferences under [Appearance] and check the box in the bottom
that says "Enable experimental Diaspora-specific modifications".
@Raven24
Raven24 / rvm_no_root.sh
Last active October 13, 2015 00:18
RVM with no-root ensurance
#!/usr/bin/env sh
# this script installs rvm with the most recent stable version of ruby
# and makes sure it is not run as root,
# based on my earlier attempt for a general purpose root avoidance
# https://gist.github.com/3930399
# the command we'll be running
export RVM_CMD="curl -L https://get.rvm.io | bash -s stable"
@Raven24
Raven24 / spec_helper.rb
Last active December 19, 2015 08:09
diaspora xml dumps
module Diaspora::Federated::Base::InstanceMethods
alias_method :old_to_diaspora_xml, :to_diaspora_xml
def to_diaspora_xml
filename = tmp_dump_path.join("#{self.class.name}.xml")
File.open(filename, 'a') { |file| file.write(to_xml.to_s) }
old_to_diaspora_xml
end
def tmp_dump_path
#!/bin/sh
#############################
#### MySQL Backup Script ####
#############################
########## CONFIG ###########
OUTPUT_FOLDER="/home/server/DBbackup"
ROOT_USER="root"