JavaScript Code
var str = "hi";
Memory allocation:
Address | Value | Description |
---|---|---|
...... |
... |
MULTIPLE PORTS IN ONE HOST | |
--------------------------- | |
Syntax: | |
Port [port] | |
NameVirtualHost *:[another_port] | |
Listen [another_port] |
function isType(arg, type) { | |
type = type.charAt(0).toUpperCase() + type.substr(1); | |
return Object.prototype.toString.call(arg) == '[object ' + type + ']'; | |
} |
JavaScript Code
var str = "hi";
Memory allocation:
Address | Value | Description |
---|---|---|
...... |
... |
I have spent quite a bit of time figuring out automounts of NFS shares in OS X...
Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:
/etc/auto_master (see last line):
#
# Automounter master map
#
+auto_master # Use directory service
#!/usr/bin/python | |
# Determine memory usage by the current user | |
# From https://wiki.webfaction.com/attachment/wiki/MiscellaneousFiles/memory_usage.py | |
# Minimal modifications to make it PEP8 compliant by https://github.com/jerivas | |
from pprint import pprint | |
import os | |
import pwd | |
import re |
#!/usr/local/bin/python2.5 | |
import subprocess | |
import sys | |
import re | |
import os,pwd | |
from pprint import pprint | |
class TerminalController: | |
""" |
Apache Cheat Sheet | |
Setup a Virtual Domain | |
NameVirtualHost * | |
<VirtualHost *> | |
DocumentRoot /web/example.com/www | |
ServerName www.example.com | |
ServerAlias example.com | |
CustomLog /web/example.com/logs/access.log combined |
Algorithm for snakes and Ladders game in python | |
1)There are two players and they are given a dice | |
2)Typically the game board has 100 cells starting from 1 to 100 | |
3)There are snakes and ladders in different cells. And each has either a ladder or a snake or nothing but not both snake and ladder in the same cell. | |
4)I use two python dictionaries namely 'snakes' and 'ladders' to declare the positions of snakes and ladders. | |
5)I make starting cell number of snake or ladder as 'key' and ending cell number as 'value' of the dictionary. | |
6)Define a function to roll the dice i.e., accepting the input from Player1 and Player2 with a checking condition of dice number to be between 1 & 6. | |
7)Define a function to check if Player1 or Player2 found ladder or a snake mouth. | |
8)Check for the 'key's in both dictionaries & proceed accordingly. | |
9)The rolling of dice continues until any of the player reaches above 99, if any of the players reach 100 they will be declared as winner of the game. |
NameVirtualHost *
DocumentRoot /web/example.com/www
#!/bin/sh | |
# PATH TO YOUR HOSTS FILE | |
ETC_HOSTS=/etc/hosts | |
# DEFAULT IP FOR HOSTNAME | |
IP="127.0.0.1" | |
# Hostname to add/remove. | |
HOSTNAME=$1 |