Skip to content

Instantly share code, notes, and snippets.

View ashee's full-sized avatar

Amitava Shee ashee

View GitHub Profile
From 0b040f756dae5d9a1f7306bdea386cb848447a1b Mon Sep 17 00:00:00 2001
From: Amitava Shee <[email protected]>
Date: Mon, 14 Feb 2011 14:47:32 -0500
Subject: [PATCH] Permission denied fix
---
lib/mirah_task.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/mirah_task.rb b/lib/mirah_task.rb
# copy and paste the command below at the shell to reset mysql password without being recorded in shell history
read -s PASS && mysqladmin -u root -p password $PASS
# another approach - read silently and export
read -s PASS && export PASS
mysqladmin -uroot -p password $PASS
read -s PASS && export PASS
mysql -uroot -p -e "GRANT SHOW DATABASES, SELECT, LOCK TABLES, RELOAD ON *.* to backup@localhost IDENTIFIED BY '$PASS';FLUSH PRIVILEGES;"
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
tar cvzf lmslc-v1.0.011.tgz --exclude=".git" --exclude=".DS_Store" lc
wget --mirror -p --convert-links -P ./output-dir url
export ANT_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=512m"
@ashee
ashee / mkramdisk.sh
Created March 28, 2011 17:15
Make ramdisk in macosx
#!/bin/bash
#######################
# A script by Salvatore Sanfilippo that I came upon in Twitter
#####################
ramfs_size_mb=1024
mount_point=~/volatile
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
@ashee
ashee / resultset-iter.scala
Created April 7, 2011 12:29
Iteratee pattern - scala version of haskell
// From Runar Oli's tweet
def enumResultSet[E,A](rs: ResultSet, iter: IterV[E, A], get: ResultSet => IO[E]): IO[IterV[E, A]] = {
def loop(i: IterV[E, A]): IO[IterV[E, A]] =
i.fold(done = (_, _) => i.pure[IO],
cont = k => next(rs) >>= (hasMore =>
if (!hasMore) i.pure[IO]
else get(rs) >>= (t => loop(k(El(t))))))
loop(iter)
}
@ashee
ashee / kvm guest - vnc over ssh tunnel.sh
Created April 14, 2011 18:06
How to connect vnc viewer to a kvm guest over ssh tunnel
amitava@bonjovi:~$ sudo virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # start latticegrid-demo
Domain latticegrid-demo started
virsh # list
menu
Status #scalazX
[Scalaz http://code.google.com/p/scalaz Git source http://github.com/scalaz/scalaz | http://vimeo.com/10482466]
[15:29] == amitava [8dd61105@gateway/web/freenode/ip.141.214.17.5] has joined #scalaz
[15:30] <amitava> hi all - i am trying to understand the following code from applicative
[15:30] <amitava> applicative[({type λ[α] = State[A, α]})#λ](StatePure, StateApply)
[15:31] <amitava> what does the construct {type λ[α] = State[A, α]})#λ do?
[15:33] == alex_boisvert [[email protected]] has quit [Ping timeout: 252 seconds]
[15:39] <larsrh> amitava: it's a partial type application
[15:40] <larsrh> imagine this syntax: α => State[A, α]