Skip to content

Instantly share code, notes, and snippets.

Avatar

Igal Koshevoy igal

  • Pragmaticraft
  • Portland, Oregon, USA
View GitHub Profile
@igal
igal / wifi_reload_iw4965_on_ubuntu_804.sh
Created Jan 24, 2009
Reload Intel 4965 wireless network drivers on Ubuntu 8.04
View wifi_reload_iw4965_on_ubuntu_804.sh
#!/bin/bash
# Reload Intel 4965 wireless network drivers on Ubuntu 8.04
set -x
sudo ruby -e '
begin
system "pkill -9 knetworkmanager"
mods = %w(iwl4965 iwlwifi_mac80211 cfg80211)
@igal
igal / gist:59510
Created Feb 6, 2009
Rails mailer configuration
View gist:59510
### Mailer configuration from config/environments/production.rb
# Documnentation:
# * http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer
# * http://api.rubyonrails.org/classes/ActionMailer/Base.html
# Let MTA handle deliveries asynchronously, rather than using default synchronous SMTP
config.action_mailer.delivery_method = :sendmail
# Let MTA handle errors, do not raise exceptions
@igal
igal / gist:80856
Created Mar 18, 2009
Diophanties if 1/2 were integer
View gist:80856
# @MarkusQ ~Diophantines would be easier if 1/2 were an integer~
class Float
def kind_of_with_easier_diophantines?(klass)
return self == 0.5 && klass == Integer || kind_of_without_easier_diophantines?(klass)
end
alias kind_of_without_easier_diophantines? kind_of?
alias kind_of? kind_of_with_easier_diophantines?
end
@igal
igal / gist:97747
Created Apr 18, 2009
.gemrc --no-ri --no-rdoc
View gist:97747
# .gemrc file that automatically adds the "--no-ri --no-rdoc" when installing gem
---
:benchmark: false
:update_sources: true
:bulk_threshold: 1000
:backtrace: false
:verbose: true
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
@igal
igal / gist:97840
Created Apr 19, 2009
Ubuntu 8.10 xorg.conf nVidia
View gist:97840
### xorg.conf accelerated devices that I'm using
# Ubuntu 8.10 with nVidia GeForce 8400M GS
Section "Device"
Identifier "Device0"
VendorName "NVIDIA Corporation"
Option "AccelMethod" "exa"
Option "MigrationHeuristic" "always"
Option "ExaNoComposite" "false"
Option "FBTexPercent" "0"
@igal
igal / .bash_prompts.sh
Created May 10, 2009
My bash prompts: short, long, and git status
View .bash_prompts.sh
# My bash prompts. To use, source the code below and call the name of the function, e.g. "shortprompt".
# Display smiley indicator for return values, date, and truncated path, e.g.:
### igal@avijja:z #13 12:37 :)
shortprompt() {
export PS1="\u@\h:\W #\! \A \`if [ \$? == 0 ]; then echo \:\); else echo \:\(; fi\` "
}
# Display shortprompt, but with non-truncated path, e.g.:
### igal@murad:~/mtmp/rubyfix #17 23:40 :)
@igal
igal / gist:117822
Created May 26, 2009
WARNING SIGNS OF A DANGEROUS CULT ... as applied to Audrey's open source community side projects
View gist:117822
Earlier this weekend, I realized that I may have become part of a dangerous
cult after having the following conversation at the foodcarts:
> Me: "We don't know those people. Should we indoctrinate them?"
> Audrey: "Yes! I have more fliers."
> http://www.vistech.net/users/rsturge/cults.html
> THE WARNING SIGNS OF A DANGEROUS CULT
...as applied to Audrey's open source community side projects
> 1. The spiritual group claims to have received special instructions from one
@igal
igal / install_fsharp_on_ubuntu.sh
Created Jun 6, 2009
Install F# on Ubuntu 9.04 -- sorta
View install_fsharp_on_ubuntu.sh
# You can run F# on Linux, FreeBSD, OS X, Solaris and even Windows using Mono.
# Here's how I got F# running on Ubuntu 9.04:
# Install dependencies:
sudo apt-get install mono-gac libmono-system-runtime2.0-cil libmono-winforms2.0-cil
# Download from http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/release.aspx
wget -c http://download.microsoft.com/download/F/7/4/F74A3170-261C-4E8F-B1A8-2E352C61A89B/fsharp.zip
# Extract files:
@igal
igal / gist:126387
Created Jun 9, 2009
List to text transformation with Clojure and Ruby
View gist:126387
; Goal: Turn Array `["foo", "bar", "baz"]` into String `"ordered: 1=foo 2=bar 3=baz"`.
; Clojure
;; Read arguments from command line
;; (def argv *command-line-args*)
;; Fake command-line arguments for use in REPL
(def argv (seque ["foo" "bar" "baz"]))
@igal
igal / gist:131922
Created Jun 18, 2009
MediaWiki uploads configuration
View gist:131922
# Allow uploads
## http://www.mediawiki.org/wiki/Manual:Configuring_file_uploads
$wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'xls', 'mpp', 'ppt', 'pdf', 'zip'));
$wgEnableUploads = true; # Enable uploads
## http://www.mediawiki.org/wiki/Manual:Mime_type_detection
$wgMimeDetectorCommand = "file -bi";
## Prevent users from replacing files: http://www.mediawiki.org/wiki/Manual:Configuring_file_uploads
$wgGroupPermissions['user']['reupload'] = false;
$wgGroupPermissions['autoconfirmed']['reupload'] = false;
## Allow users to reupload own files: http://www.mediawiki.org/wiki/Manual:User_rights