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
[alias] | |
lgb = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches |
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
function add_rand_field(collection) { | |
collection.find().forEach(function(data) { | |
collection.update({_id:data._id}, { | |
$set:{rand:Math.random()} | |
}); | |
}); | |
collection.ensureIndex({rand:1},{background:true}) | |
} |
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
class Node: | |
def __init__(self,value=None,kids=[]): | |
self.value = value | |
self.kids = kids | |
def rdfs(n, previsit, postvisit): | |
'''Recursive depth-first traversal''' | |
previsit(n) | |
for k in n.kids: |
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
import copy | |
import math | |
import logging | |
def balance_cnt(n): | |
"""Considering all nxn matrices consisting entirely of 0s and 1s, | |
return the number of matrices which have exactly n/2 ones in each column and each row. | |
Solution using dynamic programming as outlined here: | |
https://en.wikipedia.org/wiki/Dynamic_programming#A_type_of_balanced_0.E2.80.931_matrix | |
Produces answers in this sequence (for n/2) https://oeis.org/A058527 |
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
package algostudy; | |
import java.util.ArrayList; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.PriorityQueue; | |
import java.util.Queue; |
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
# | |
# Cookbook Name:: imgmuck | |
# Recipe:: default | |
# | |
# Copyright 2012, Scaled Recognition, all rights reserved | |
# | |
include_recipe "git" | |
include_recipe "python" | |
include_recipe "application" |
NewerOlder