This file contains 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
[default] | |
aws_access_key_id=<access_key> | |
aws_secret_access_key=<secret_key> |
This file contains 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
# plugins/redmine_backlogs/lib/backlogs_issue_patch.rb | |
def backlogs_after_save | |
# .. | |
# omitted | |
# .. | |
if self.story? | |
# omitted | |
tasklist = RbTask.find(:all, :conditions => ["root_id=? and lft>? and rgt<? and | |
( |
This file contains 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
# This is the Twisted Get Poetry Now! client, version 2.1. | |
# NOTE: This should not be used as the basis for production code. | |
import optparse,sys | |
from twisted.internet.protocol import Protocol, ClientFactory | |
from twisted.internet import reactor | |
from twisted.python.failure import Failure |
This file contains 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
/******************************************************************************************************/ | |
/* Exercise: Errors #57 */ | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type ErrNegativeSqrt float64 |
This file contains 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
/******************************************************************************************************/ | |
/* Exercise: concurrency/8 Equivalent Binary Trees */ | |
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) |
This file contains 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
/* | |
The problem is shown below. | |
There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. | |
Your job is to fence the entire garden using the minimum length of rope as it is expensive. | |
The garden is well fenced only if all the trees are enclosed. | |
Your task is to help find the coordinates of trees which are exactly located on the fence perimeter. | |
****************************************************************************************** |
This file contains 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
/* | |
621. Task Scheduler | |
Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task could be done in one interval. For each interval, CPU could finish one task or just be idle. | |
However, there is a non-negative cooling interval n that means between two same tasks, there must be at least n intervals that CPU are doing different tasks or just be idle. | |
You need to return the least number of intervals the CPU will take to finish all the given tasks. | |
Example 1: |
This file contains 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
/* | |
662. Maximum Width of Binary Tree | |
Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a full binary tree, but some nodes are null. | |
The width of one level is defined as the length between the end-nodes (the leftmost and right most non-null nodes in the level, where the null nodes between the end-nodes are also counted into the length calculation. | |
Example 1: | |
Input: |
This file contains 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
""" | |
Email字串處理 | |
輸入email(S)和網域名(C) | |
Function(S,C) | |
S=["aa bb cc; xx yy z-z; aa bb; aa bx cc"] | |
C=["test"] |
This file contains 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
func findMinMoves(machines []int) int { | |
if machines == nil { | |
return -1 | |
} | |
sum, size := sum(machines...), len(machines) | |
fmt.Println(sum,size) | |
if sum % size == 0 { | |
target := sum / size | |
cnt, res := 0, 0 |
OlderNewer