Skip to content

Instantly share code, notes, and snippets.

View asimjalis's full-sized avatar

Asim Jalis asimjalis

View GitHub Profile
@asimjalis
asimjalis / sh-timeout.clj
Created July 14, 2011 19:12
How to call clojure.contrib.shell-out/sh with timeout
(use '[clojure.contrib.shell-out :only [sh]])
(defn sh-timeout [timeout-in-seconds & args]
(.get
(future-call #(apply sh args))
timeout-in-seconds
(java.util.concurrent.TimeUnit/SECONDS)))
@asimjalis
asimjalis / micro-task-process.md
Created October 27, 2011 16:59
How to use the MicroTask process to complete projects

How to use the MicroTask process to complete projects

by Asim Jalis, MetaProse.com

The MicroTask process is a technique for taking on large and vague projects and then gradually nibbling on them until they are done.

Besides getting things done, this technique will make your work fun. It will turn it into a game. Instead of working on a large and

@asimjalis
asimjalis / python-zip.md
Created December 7, 2012 23:33
How to deploy a Python application as a zip file

How to deploy a Python application as a zip file

by Asim Jalis, MetaProse.com

Create a file __main__.py containing:

print "Hello world from Python"

Zip up the Python files (in this case just this one file) into app.zip by typing:

@asimjalis
asimjalis / ruby-on-pc.md
Created December 8, 2012 01:16
How to install Ruby on Rails on Windows PC

How to install Ruby on Rails on Windows PC

by Asim Jalis, MetaProse.com

Here are the steps for installing Ruby on Rails on a Windows PC and verifying that the install was successful.

  1. Go to http://www.railsinstaller.org.

  2. Click on “Download the Kit”.

@asimjalis
asimjalis / csbat.md
Created December 8, 2012 02:01
How to use C# in bat and cmd files

How to use C# in bat and cmd files

by Asim Jalis, MetaProse.com

Here are the steps for how to write bat and cmd files with C#.

Here is the problem this solves: Frequently I just want to write a short C# snippet. I don't want to write it as a source file, compile it, and run it. I'd rather just put the snippet in a bat file and run the bat file. I want to shorten the code-compile-execute loop to just code-execute.

The following steps show you how to create CSBat.exe which solves this problem. Note: The in-memory compiler code was taken from Don Box's CSRepl from his blog.

@asimjalis
asimjalis / perl-shell.md
Created December 8, 2012 15:34
How to run Perl in an interactive shell

How to run Perl in an interactive shell

by Asim Jalis, MetaProse.com

An interactive shell is useful for quickly trying out different commands. While Ruby, Python, and Clojure come with interactive shells, Perl does not. However, it is easy to create one using this one-liner on Unix systems:

perl -e 'do{print("perl> ");$_x=<>;chomp $_x;print(eval($_x)."\n")}while($_x ne "q")'
@asimjalis
asimjalis / Util.java
Last active February 1, 2016 09:47
Useful Java utility functions.
package core;
import java.io.*;
import java.net.*;
/**
* Useful utility functions.
*/
public class Util {
@asimjalis
asimjalis / myLib.js
Created August 6, 2013 00:26
JavaScript library by Jeremy Osborne which implements a light-weight version of some ideas from jQuery.
(function() {
/**
* My JavaScript library.
*
* @author [your name here]
*/
/**
* @class A namespace is a collection of functions and classes.
# To run a command on all 4 hosts type: ethm COMMAND
# For example: ethm hostname
# You can also type:
#
# eth COMMAND # Run COMMAND on elephant, tiger, horse
# thm COMMAND # Run COMMAND on tiger, horse, monkey
# h COMMAND # Run COMMAND on horse
# m COMMAND # Run COMMAND on monkey
#
# And so on.
@asimjalis
asimjalis / TotalOrderPartitionerExample.java
Created September 25, 2014 07:50
Demonstrates how to use Total Order Partitioner on Word Count.
import java.io.*;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapreduce.lib.input.*;
import org.apache.hadoop.mapreduce.lib.output.*;
import org.apache.hadoop.mapreduce.lib.partition.*;
import org.apache.hadoop.mapreduce.lib.reduce.*;