escape ``
To ignore changes in already tracked files, run this:
git update-index --assume-unchanged
git submodule init git submodule update
--no-metadata
option makes this more viable for a one-shot import.
git-svn clone --stdlayout --no-metadata -Aauthors.txt svn+ssh://biostat.mc.vanderbilt.edu/usr/local/subversion/Ryaml
xclip
(apt-get install xclip
).
Sweet.
awk
prints things (with print
), change the OFS
variable like so:
awk 'BEGIN { OFS="," } {print $1, $2}'
#!/bin/sh # Configure your favorite diff program here. DIFF="/usr/bin/vim-diff" # Subversion provides the paths we need as the sixth and seventh # parameters. LEFT=${6} RIGHT=${7} # Call the diff command (change the following line to make sense for # your merge program). $DIFF $LEFT $RIGHT # Return an errorcode of 0 if no differences were detected, 1 if some were. # Any other errorcode will be treated as fatal.» Download
ALTER TABLE foo ADD id INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY(id);Credits to Daniel Schneller.
pager less -S
\n
Exim4 configuration sucks. It took me 3 or 4 hours to figure this out.
Exim4 and TLS don't work together well, apparently. To make exim work correctly, edit /etc/exim4/exim4.conf.template and add this line just under the driver line in remote_smtp_smarthost section, so that it looks something like this:remote_smtp_smarthost: debug_print = "T: remote_smtp_smarthost for $local_part@$domain" driver = smtp hosts_avoid_tls = * hosts_try_auth = ${if exists {CONFDIR/passwd.client}{DCsmarthost}{}} tls_tempfail_tryclear = false DEBCONFheaders_rewriteDEBCONF DEBCONFreturn_pathDEBCONFRe-run
update-exim4.conf
and then restart exim4.
public/javascripts
and put this into your application layout:
<!--[if lt IE 7]> <script defer type="text/javascript" src="<%= javascript_path "pngfix" %>"></script> <![endif]-->
To delete users using stored procedures, run this:
DECLARE @RC int DECLARE @ApplicationName nvarchar(256) DECLARE @UserName nvarchar(256) DECLARE @TablesToDeleteFrom int DECLARE @NumTablesDeletedFrom int SET @ApplicationName = 'foo'; SET @UserName = 'some guy'; SET @TablesToDeleteFrom = 15; EXECUTE @RC = [foo].[dbo].[aspnet_Users_DeleteUser] @ApplicationName ,@UserName ,@TablesToDeleteFrom ,@NumTablesDeletedFrom OUTPUT SELECT @NumTablesDeletedFrom;The 15 in
TablesToDeleteFrom
is a flag that means to delete from all user-related tables (4 total).
I always forget how to do this, so here it is:
<html> <head> <title>Redirecting...</title> <meta http-equiv="refresh" content="1;/rhubarb"> </head> <body> Please click <a href="/rhubarb">here</a> if you are not redirected. </body> </html>
pg_hba.conf
file:
# TYPE DATABASE USER CIDR-ADDRESS METHOD local all all md5
/etc/postgresql/8.1/main/postgresql.conf
.
~/.pgpass
file, chmod it to 600
, and add entries that follow this format:
hostname:port:database:username:password
localhost
doesn't seem to work for hostname
, so use *
unless you want to manually specify localhost
on the psql command line via --host
.
/etc/X11/default-display-manager
.
apt-get install gcc kernel-package libc6-dev libncurses5-dev modutils module-init-toolsSteps:
make-kpkg --append-to-version=-2024-09-13 --revision=1 kernel_image
update-grub
yes $'\n' | make oldconfig
Double check the permissions on the source tree
Here's an init.d script to get the fastri server running on boot. You need to create the fastri user, make the /etc/fastri directory, and change ownership of /etc/fastri to be owned by fastri. Whammo.
» Downloadsudo gem install postgres -- --with-pgsql-include-dir=/usr/include/postgresql
sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config(credit)
./configure --prefix=/usr/local --program-suffix=1.9 --with-readline-dir=/opt/local make sudo make install
$ irb >> /blah/.clone SecurityError: can't modify literal regexp from (irb):1:in `initialize_copy' from (irb):1:in `clone' from (irb):1 >>This is a problem if you serialize a literal regular expression in a model. ActiveRecord clones its attributes before saving, and since you can't clone a literal regexp, you best be changin' that. Use
Regexp.new("blah")
or Regexp.new(/blah/)
instead.
mkdir vendor/gems
ruby freeze_gem.rb [ -o ENV ] [ -v VERSION ]
config/environment.rb
:
-o
(--only
) option lets you specify which environments you want the gem to be loaded in. If you only want to load the gem in development and test environments, do -o development,test
.
The -v
(--version
) options lets you specify which version of the gem you want to freeze. Hip, hip, hoorah.
require 'pp' require 'rake' require 'rake/testtask' require 'rake/rdoctask'
# credits to Blair Zajac (blair@orcaware.com) for this idea: module Rake class Application def remove_task(name) @tasks.delete(name) end end end require 'tasks/rails'Rake.application.remove_task 'test:functionals'
, or whatever the relevant rake
task is.
If you want to run <insert some other behavior type> tests in a spec file that isn't in the <that other behavior type you inserted before> spec folder, you can specify the behavior manually by using :behaviour_type => :<yes, that same behavior type again>.
For example, if I want to run a controller test in myspec/libs
directory, I do:
Spec::DSL::BehaviourFactory::BEHAVIOUR_CLASSES
to see what the behavior types are. Actually, the BEHAVIOUR_CLASSES
constant is in the metaclass of Spec::DSL::BehaviourFactory
, which makes it a little tricky to get at if you're not in the right context. First install the metaid gem, then run irb
(not script/console) from your Rails root directory, and paste this in:
require 'rubygems' require 'metaid' require 'spec/spec_helper'
p Spec::DSL::BehaviourFactory.metaclass.const_get("BEHAVIOUR_CLASSES")BEHAVIOUR_CLASSES
looks like this:
config/environment.rb
like so:
apt-get install odbcinst1debian1 unixodbc unixodbc-dev tdsodbc freetds-dev libodbc-ruby1.8 libdbd-odbc-ruby sqsh
The instructions actually work!! Wow.
The magic happens when something calls one of the <adapter>_connection methods from ActiveRecord::Base. Most (if not all) of the time these methods are called as a result of a call to the connection() method, which tries to retrieve a connection. The establish_connection() method doesn't actually connect to a database, it just records the information needed to connect to a database.
has_many :bars
. The has_many
class method defines the instance method bars
, which returns a HasManyAssociation
instance object. So what the hell is going on with the code below?
f.bars.class
HasManyAssociation
?? The reason why this happens is because of some tomfoolery by AssociationProxy
, the superclass of the association classes. AssociationProxy
does this number:
class
, inspect
, to_s
, etc.). So when I do: f.bars.class
, method_missing
is called. Here's what method_missing
essentially does:
@target
, which is the Array
. Jeez. So, the class of f.bars
really is
HasManyAssociation
.
Here's a custom script/spec that automatically uses the options in spec/spec.opts. Also, if called without arguments, it runs the spec file that was most recently changed.
puts "====== running #{spec_files[0]} ======" end
#exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT)) exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(args, STDERR, STDOUT))fenc
to be 'latin1' (instead of 'ucs-2le'). Or, do:
iconv -f UCS-2LE -t LATIN1 somefile.txt
/etc/pam.d/common-session
:
session optional pam_umask.so umask=027This doesn't really seem to work.
encfs ~/.crypt ~/crypt
or something similar to create a virtual filesystem that's encrypted!
/^[\w!#\$%&'*+\-\/=?^`{|}~][\w!#\$%&'*+\-\/=?^`{|}~.]{0,62}[\w!#\$%&'*+\-\/=?^`{|}~]@([\w\d\-]+\.)+[\w\d\-]+$/
export IFS=$'\n'
num <- length(xml$doc$children$weeklyartistchart$children) artists <- data.frame(name=I(character(num)), count=integer(num))
compileInfo <- function(i, parent) { artists[i,'name'] <<- xmlValue(parent$childrenI$children$name$children$text) artists[i,'count'] <<- as.integer(xmlValue(parent$childrenI$children$playcount$children$text)) } lapply(1:num, compileInfo, parent = xml$doc$children$weeklyartistchart)CFLAGS="-g3" FFLAGS="-g3" CXXFLAGS="-g3" FCFLAGS="-g3" ./configure --enable-R-shlib makeMy script to run my local copy of R (~/bin/myR):
R_VERSION=2.3.0 R_EXEC=~/src/build/R-${R_VERSION}/bin/R R_ARGS= if [ -z $1 ]; then R_ARGS="--no-save $*" else if [ $1 = "CMD" ]; then R_ARGS="$*" else R_ARGS="--no-save $*" fi fi
R_LIBS=~/src/build/R-${R_VERSION}/library LD_LIBRARY_PATH=~/src/build/R-${R_VERSION}/lib R_HOME=~/src/build/R-${R_VERSION}
eval "$R_EXEC $R_ARGS":set pasteFor a toggle, put this in your ~/.vimrc:
set pastetoggle=<F9>I got this tip from here.
The idea behind bootstrapping is taking several samples (with replacement) of your original data set and performing calculations on those samples (such as mean, median, etc). You can then figure out the behavior of those calculations. Use this method when you don't want to make any assumptions about what distribution your data conforms to.
Validating the accuracy of models when predicting stuff about future data is possible with bootstrapping. Efron's "enhanced bootstrap" technique involves estimating the "bias due to overfitting". Overfitting occurs when a model takes too many variables into account. The bias estimated by bootstrapping validation can be subtracted from the original accuracy index (like R-squared) in order to produce the "expected bias-corrected index".ROC curves can be used to determine how good a scoring algorithm is. If you have some data you want to test, you first need some "gold standard" to separate your data into true positives and true negatives. First you run your test on the data and get scores. Then, you need to put each element in your data into a positive or negative subset depending on what the gold standard says. Next, you plot those two subsets on the same graph. The ROC curve is the plot of true positives against false positives based on the threshold you set for your test. If the area under the ROC curve is close to 1.0, your test is close to the "gold standard".
The ROC50 metric considers only the top of the sort down to the fiftieth non-family member. The metric has a value of one if all the true family members come before any non-family members in a sort of the sequences in the database. It has the value zero if fifty non-family members appear before the first family member.
install
program. They really should have called it meme.install
instead, since if you run ./configure with the MEME path line before the path to the actual install
program, ./configure will make its Makefiles to call that install instead of the real one. Bad idea.
If gdb stops working, make sure the SHELL environment variable is set! Yarrrr.
scrypt
magic word, values of parameters, and the salt
After the setup phase, we have the derived key and a header that is 96 bytes long.
ldapsearch -W -H ldaps://ldap.vunetid.vanderbilt.edu/ -D uid=vunetid,ou=people,dc=vanderbilt,dc=edu -b ou=people,dc=vanderbilt,dc=edu "(uid=vunetid)"
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
sh | add-ssh-key.sh | manage | 213 bytes | 23 Jan 2008 - 17:46 | JeremyStephens | |
sh | diffwrap.sh | manage | 419 bytes | 01 Feb 2008 - 12:52 | JeremyStephens | |
EXT | fastri | manage | 1 K | 19 Nov 2008 - 10:37 | JeremyStephens | fastri init.d script |
rb | freeze_gem.rb | manage | 2 K | 25 Jul 2007 - 17:46 | JeremyStephens | script to freeze gems into a rails directory |
sh | rails-dev.sh | manage | 3 K | 26 Feb 2007 - 11:01 | JeremyStephens | my rails development konsole script [OLD] |
png | rails.png | manage | 1 K | 02 Apr 2007 - 11:22 | JeremyStephens | rails icon |
rb | rails_dev.rb | manage | 7 K | 19 Dec 2007 - 10:23 | JeremyStephens | KDE-integrated rails development script |
rb | spec_conv.rb | manage | 2 K | 08 Jun 2007 - 17:11 | JeremyStephens | script to convert a spec into a test::unit |
conf | xorg.conf | manage | 2 K | 03 Jul 2008 - 01:20 | JeremyStephens | dual-display configuration for a macbook running kubuntu |