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 Solution: | |
def productExceptSelf(self, nums: List[int]) -> List[int]: | |
# dynamic programming | |
products = [] | |
memo = {} | |
for i in range(0, len(nums)): | |
product = 1 | |
leftProduct = self.productBetween(nums, memo, 0, i - 1) | |
rightProduct = self.productBetween(nums, memo, i + 1, len(nums) - 1) |
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
git log --format='%aN' README.md | sort | uniq |
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
# see https://8thlight.com/blog/colin-jones/2015/11/06/dtrace-even-better-than-strace-for-osx.html | |
sudo dtruss -p PID |
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
http://recordit.co/ | |
http://beyondgrep.com/install/ | |
https://itunes.apple.com/us/app/status-clock/id552792489?mt=12 |
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
@ECHO OFF | |
IF NOT "%~f0" == "~f0" GOTO :WinNT | |
@"C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "C:/RailsInstaller/Ruby2.2.0/bin/bundle" %1 %2 %3 %4 %5 %6 %7 %8 %9 | |
GOTO :EOF | |
:WinNT | |
@"C:\RailsInstaller\Ruby2.2.0\bin\ruby.exe" "%~dpn0" %* |
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
find src/ -type f -exec sed -i '' 's/foo/bar/g' {} + |
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
guard :minitest, test_folders: '.' do | |
# with Minitest::Unit | |
watch(%r{^(.+)_test\.rb}) { |m| "./#{m[1]}_test.rb" } | |
watch(%r{^(.+)\.rb}) { |m| "./#{m[1]}_test.rb" } | |
end |
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
require 'elasticsearch' | |
require 'pp' | |
require 'hashie' | |
@count = 1 | |
INDEX = 'didyoumean-test' | |
TYPE = 'test' | |
CLIENT = Elasticsearch::Client.new(log: true, send_get_body_as: 'POST') |
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
require 'pp' | |
by_ip = {} | |
DATA.each_line do |line| | |
request = line.split(' ') | |
url = request[1] + ' ' + request[2].gsub('"', '') | |
ip = request[4] | |
by_ip[ip] ||= [] |
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
# only tested on development machine | |
curl "localhost:9200/_cluster/health?level=indices&pretty=true" | grep -B 1 '"status" : "red"' | grep "{" | cut -d"\"" -f2 | while read -r line ; do curl -XDELETE localhost:9200/$line && echo; done |
NewerOlder