Skip to content

Instantly share code, notes, and snippets.

@rgo
rgo / gist:83527
Created March 23, 2009 12:19
Connect to TS
# Connect to terminal server with license problems("without" delays)
rdesktop <ip> -n <random_name> -a 15 -z -P
# MySQL gui tools hangs when select an schema
export DEBUG_DONT_SPAWN_FETCHES=1
/usr/bin/mysql-admin
@rgo
rgo / gist:86642
Created March 27, 2009 11:09
Restore table mysql
#!/bin/bash
# Restore table(table+data or only data) from mysqldump file
#
# NOTE: 'foo' is the table to restore and 'bar' next table in backup.
# Restore one table
zcat backup_20090316-0200.sql.gz | awk '/Table structure for table .foo./,/Table structure for table .bar./{print}' > output.sql
# Restore only data from one table
zcat backup_20090316-0200.sql.gz | awk '/Dumping data for table .foo./,/Table structure for table .bar./{print}' > output.sql
@rgo
rgo / gist:96968
Created April 17, 2009 10:55
; Enable username:[email protected] in Internet Explorer and Windows Explorer.
; Enable username:[email protected] in Internet Explorer and Windows Explorer.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]
"iexplore.exe"=dword:00000000
"explorer.exe"=dword:00000000
@rgo
rgo / gist:108039
Created May 7, 2009 10:15
wp-cron is having mod_security error 500
# Add this to every host running WP (either in Apache conf files - a recommended method - or in .htaccess):
<Files ~ "wp-cron\.php$">
<IfModule mod_security.c>
SecFilterEngine Off
</IfModule>
Order Deny,Allow
Deny from All
Allow from my.own.IP.address
</Files>
@rgo
rgo / gist:110574
Created May 12, 2009 16:29
Apache config - Expires by type
ExpiresActive on
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
@rgo
rgo / photos_controller_test.rb
Created May 14, 2009 00:51
how to send a multipart post?
test "should create photo" do
assert_difference('Photo.count') do
post :create, :album_id => albums(:gallery_one_one).to_param, :photo => {:name => 'photo_fooooo', :description => 'bar', :image => fixture_file_upload('rails.png')}
end
assert_redirected_to admin_album_photos_path(assigns(:album))
end
@rgo
rgo / gist:113090
Created May 17, 2009 18:39
relative_url_root gotcha rails 2.3.x passenger
Problem: `load_missing_constant’: uninitialized constant ActionController::AbstractRequest (NameError)
Solution:
-ActionController::AbstractRequest.relative_url_root = "your_root"
+config.action_controller.relative_url_root = "your_root"
# More gotchas: http://giantrobots.thoughtbot.com/2009/4/15/rails-2-3-2-upgrade-gotchas
@rgo
rgo / GIT_NOTES
Created June 18, 2009 10:50
Git Notes
FORK - PUSH - PULL - KEEPING THE TRACK
======================================
FORK
====
Le doy a fork en el repositorio y luego uso "Your clone URL".
$ git clone [email protected]:rgo/drgtest.git
@rgo
rgo / next_previous_records.rb
Created June 24, 2009 22:10
next and previous record methods
# You need to call the next and previous records. Just put the following in your model.
# From http://snippets.dzone.com/posts/show/7163
def next
self.class.find :first,
:conditions => ["created_at > ? ",self.created_at],
:order => "created_at DESC"
end
def previous
self.class.find :first,