This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<6>[ 0.000000] Initializing cgroup subsys cpu | |
<5>[ 0.000000] Linux version 3.0.31+ (hashcode@hashcode-UB) (gcc version 4.4.3 (GCC) ) #2 SMP PREEMPT Mon Jul 2 00:43:34 PDT 2012 | |
<4>[ 0.000000] CPU: ARMv7 Processor [411fc093] revision 3 (ARMv7), cr=10c5387d | |
<4>[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache | |
<4>[ 0.000000] Machine: OMAP4430 | |
<4>[ 0.000000] Ignoring tag cmdline (using the default kernel command line) | |
<6>[ 0.000000] Reserving 16777216 bytes SDRAM for VRAM | |
<4>[ 0.000000] Memory policy: ECC disabled, Data cache writealloc | |
<6>[ 0.000000] *********************** | |
<6>[ 0.000000] OMAP4430 ES2.3 type(GP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------- beginning of /dev/log/system | |
I/LocationManagerService( 261): remove passive (pid 1430), next minTime = 0 | |
I/LocationManagerService( 261): request passive (pid 1430) 0 0 | |
I/LocationManagerService( 261): remove passive (pid 1430), next minTime = 0 | |
I/LocationManagerService( 261): request passive (pid 1430) 0 0 | |
I/LocationManagerService( 261): remove passive (pid 1430), next minTime = 0 | |
I/LocationManagerService( 261): request passive (pid 1430) 0 0 | |
I/LocationManagerService( 261): remove passive (pid 1430), next minTime = 0 | |
I/LocationManagerService( 261): request passive (pid 1430) 0 0 | |
I/LocationManagerService( 261): request passive (pid 14979) 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Implement a queue with two stacks | |
Interview practice from coding for interviews - March 2014 | |
""" | |
class Staqueue(object): | |
""" Implements a queue with two stacks | |
One stack is used for enqueing, and the other dequeing. If an enqueue is requested |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<limits.h> | |
#include<math.h> | |
/** returns the number of 1 bits in x */ | |
short countBits(int x) { | |
short count = 0; | |
int mask = 1; | |
for(short i = 0; i < sizeof(x); i++) { | |
if((mask & x) == mask) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Combines two maps with the same key into a map of key to tuple(value 1, optional value 2) | |
*/ | |
public static <K, V1, V2> Map<K, Tuple<V1, Optional<V2>>> | |
zip(Map<K, V1> map1, Map<K, V2> map2) | |
{ | |
Map<K, Tuple<V1, Optional<V2>>> results = new HashMap<>(); | |
for (K key : map1.keySet()) | |
{ | |
V1 val1 = map1.get(key); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
/* sets bits i through j in tgt to match src */ | |
void setBits(int *tgt, int src, short i, short j) { | |
int mask = (((int)pow(2, j - i + 1)) - 1) << i; | |
*tgt = (src & mask) | (*tgt & ~mask); | |
} | |
#include <math.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DecimalToBinary { | |
/** Given a decimal number as a string, returns the binary representation as a string or "ERROR" if it can't be converted to binary */ | |
public static String decimalToBinary(String decimal) { | |
int dec = 0; | |
try { | |
dec = Integer.parseInt(decimal); | |
} catch(NumberFormatException ex) { | |
return "ERROR"; | |
} | |
if(dec == 0) return "0"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isBalanced(root): | |
""" returns true if the tree is balanced, i.e. the depths of the children vary by no more than one """ | |
heights = set() | |
getHeights(root, 0, heights) | |
return not heights or (max(heights) - min(heights) <= 1) | |
def getHeights(node, h, heights): | |
""" add the height of this node's children to heights """ | |
if node is None: | |
return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dokku Deployment Notes | |
====================== | |
Created a $5 Linode: https://www.linode.com/pricing | |
Set up dokku using instructions: http://dokku.viewdocs.io/dokku/getting-started/installation/ | |
Used the Linode-specific instructions to enable AUFS http://dokku.viewdocs.io/dokku/getting-started/install/linode/ | |
Used the bootstrap script: | |
wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh; | |
sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
print_usage() { | |
echo "Usage: ./deploy.sh [staging|prod]" | |
exit 1 | |
} | |
ENVS=( prod staging ) | |
if [[ $# -lt 1 ]]; then |
OlderNewer