Skip to content

Instantly share code, notes, and snippets.

@bonyiii
bonyiii / gist:1625914
Created January 17, 2012 09:45
find duplicatet values in a table with SQL
# http://www.mximize.com/how-to-find-duplicate-values-in-a-table-
# http://www.petefreitag.com/item/169.cfm
With the SQL statement below you can find duplicate values in any table, just change the tablefield into the column you want to search and change the table into the name of the table you need to search.
In your recordset you will see the tablefield and how many times it is found as a duplicate.
SELECT tablefield, COUNT(tablefield) AS dup_count
FROM table
GROUP BY tablefield
@bonyiii
bonyiii / gist:1471379
Last active April 20, 2023 15:01
restore overwritten files linux
http://www.ehow.com/how_7517984_restore-overwritten-file-linux.html
Assess which partition on your computer you need to access to recover the files.
2
Unmount the directory using the "unmount" command in the interface. This will help prevent damaging the file you are trying to recover.
3
Type "debugfs" in the command line interface (all typing without quotation marks) and include the file system where the overwritten file is into the command. For example, typing "debugfs usr/personal" will bring up your personal directory. Hit "Enter" after typing the command.
4
http://www.zachgraeve.com/2006/10/01/center-abosulte-position-div/
.center {
position: absolute;
top: 0px;
left: 50%;
width: 140px;
margin-left: -70px
}
########
@bonyiii
bonyiii / gist:1363518
Created November 14, 2011 08:20
compile passenger as user mod_rails
rvm use ruby-1.9.2@rails31
gem install passenger
export CPLUS_INCLUDE_PATH=/usr/include/apache2/:/usr/include/apr-1
export PATH=$PATH:/usr/sbin
rake apache2 --trace
#/etc/make.conf
APACHE2_MODULES="alias auth_basic authn_alias authn_file authz_groupfile authz_host authz_user cache dav dav_fs dav_lock deflate headers proxy proxy_http rewrite setenvif status autoindex dir env log_config logio mime negotiation filter expires"
APACHE2_MPMS="prefork"
@bonyiii
bonyiii / gist:1319545
Created October 27, 2011 13:34
capistrano bundler deployment switch back and forth development and production mode
http://www.cowboycoded.com/2010/08/10/using-2-sources-for-a-gem-in-different-environments-with-bundler/
export MY_BUNDLE_ENV=dev
bundle / bundle update
git add -u
git ci -m "switching back development mode"
git push
unset MY_BUNDLE_ENV
bundle
@bonyiii
bonyiii / gist:1247094
Created September 28, 2011 05:56
How to find and delete all hard links to a file
# http://linuxcommando.blogspot.com/2008/09/how-to-find-and-delete-all-hard-links.html
How to find and delete all hard links to a file
Deleting a file is deceptively simple. You can simply use the rm command like this.
$ rm file1
However, if the file has one or more hard links to it, life gets more interesting. You need to seek and destroy all hard links to the file.
@bonyiii
bonyiii / gist:1194154
Created September 5, 2011 05:19
devise background job
http://blog.devinterface.com/2011/03/how-to-send-email-asynchronously-using-devise-and-rails3/
also check starred gists
@bonyiii
bonyiii / gist:1170156
Created August 25, 2011 07:23
how to avoid assets pipeline concatenate mulitple files in developement mode 3.1
@bonyiii
bonyiii / gist:1167436
Created August 24, 2011 06:43
dátum időbélyeggé sé vissza

To timestamp

date -ud "2011-05-05" +%s

To time from timestamp

date -d "@1304553600"

RUBY

@bonyiii
bonyiii / gist:1108959
Created July 27, 2011 08:57
how convert a rails3 model to json for most jquery plugins
#http://asciicasts.com/episodes/258-token-fields
@authors = Author.all
respond_to do |format|
format.html
format.json { render :json => @authors.map(&:attributes) }
end
or (jqgrid)