Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xzf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..
#!/usr/bin/env python2.6
from AddressBook import *
import pprint
def addressBookToList():
"""
Read the current user's AddressBook database, converting each person
in the address book into a Dictionary of values. Some values (addresses,
phone numbers, email, etc) can have multiple values, in which case a
#!/usr/bin/env python2.6
from AddressBook import *
import pprint
def addressBookToList():
"""
Read the current user's AddressBook database, converting each person
in the address book into a Dictionary of values. Some values (addresses,
phone numbers, email, etc) can have multiple values, in which case a

Creating a Happy Git Environment on OS X

Step 1: Install Git

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global apply.whitespace nowarn
@abmohan
abmohan / flatten.js
Last active August 25, 2020 06:11
Flattening An Array of Arbitrarily Nested Arrays
/**
* Flattens an array of arbitrarily nested arrays
* @param {Array} sourceArray [array of arbitrarily nested arrays]
* @return {Array} [flattened array]
*/
function flatten(sourceArray) {
return sourceArray.reduce(
(flattenedArray, currentArrayElement) => {
// append current array element to end of array
return flattenedArray.concat(
@abmohan
abmohan / CLAM_Client_DigitalOcean.md
Last active May 19, 2019 13:19
Set up a cloud CLAM Coin Digging/Mining Client on Ubuntu

Cloud CLAM Digger/Miner on Ubuntu

CLAMs are awesome!

Proof of stake, rather than proof of work, allows for everyone who's chipped in to receive a piece of the pie.

Follow the steps below to set up your own cloud CLAM digger (i.e. the equivalent of a bitcoin miner) on Digital Ocean

Setting up Digital Ocean

@abmohan
abmohan / clojure.md
Created January 26, 2017 01:55
Setting Up Clojure on OS X

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

I appreciate the effort you've put into documenting this, but there are a number of inaccuracies here that need to be addressed. We get

@abmohan
abmohan / app.component.ts
Created April 3, 2017 02:27 — forked from Hotell/app.component.ts
@ngrx/store integration with ngMetadata/Angular 1
import { Store } from 'ngrx-one/store';
import { INCREMENT, DECREMENT, RESET } from './counter';
interface AppState {
counter: number;
}
@Component({
selector: 'my-app',
template: `
@abmohan
abmohan / 01-directory-structure.md
Created December 3, 2017 15:29 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@abmohan
abmohan / Output
Created July 1, 2020 05:15 — forked from DazWorrall/Output
Testing file upload handling in Flask
in upload handler
in file close
..
----------------------------------------------------------------------
Ran 2 tests in 0.021s
OK