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
| resource "google_pubsub_topic" "export-logs-to-datadog" { | |
| name = "export-logs-to-datadog" | |
| } | |
| resource "google_pubsub_subscription" "datadog-logs" { | |
| name = "datadog-logs" | |
| topic = google_pubsub_topic.export-logs-to-datadog.name | |
| message_retention_duration = "604800s" | |
| retain_acked_messages = false |
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
| resource "google_service_account" "datadog-connect" { | |
| account_id = "datadog-connect" | |
| display_name = "Service Account for datadog connection" | |
| } | |
| resource "google_project_iam_member" "datadog-connect" { | |
| for_each = toset([ | |
| "roles/cloudasset.viewer", | |
| "roles/compute.viewer", | |
| "roles/monitoring.viewer", |
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
| // note this stays outside of updateDatabaseFn struct. | |
| // fields in pardo has to be json-serielizable so you cannot have db instance as field | |
| var database *gorm.DB | |
| type updateDatabaseFn struct { | |
| Env string `json:"env"` | |
| Project string `json:"project"` | |
| } | |
| func init() { | |
| beam.RegisterDoFn(reflect.TypeOf((*updateDatabaseFn)(nil)).Elem()) |
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
| console.log("This is test"); |
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
| start_time = Time.now | |
| files = Dir.glob("./**/*.{js,jsx}").reject do |path| | |
| path.include?("node_modules") || path.include?("khan-linter") || path.include?("tests") | |
| end | |
| files_to_delete = files.select do |f| | |
| basename = File.basename(f) | |
| result = `grep --exclude-dir={node_modules,khan-linter,\.git} --exclude=#{basename} -rlw '.' -e #{basename.split(".")[0]}` | |
| result.empty? | |
| 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
| function parseRgb(color) { | |
| red = parseInt("0x" + color.substr(1, 2)); | |
| green = parseInt("0x" + color.substr(3, 2)); | |
| blue = parseInt("0x" + color.substr(5, 2)); | |
| return [red, green, blue]; | |
| } | |
| // YUV | |
| function calcBrightness(color) { | |
| var rgb = parseRgb(color); |
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
| /** | |
| * Selenium WebDriverを使ってテストしてるときに,JSCoverによってテスト対象のJavaScriptのカバレッジを測定する | |
| */ | |
| class MyAwesomeTest { | |
| private static Thread server; | |
| private static WebDriver driver = getInstrumentedDriver(); | |
| // JSCover起動用オプション | |
| // 3129ポートを利用してプロキシとして起動する | |
| private String[] args = new String[]{ |
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 "httparty" | |
| require "nokogiri" | |
| response = HTTParty::get('http://uifaces.com/authorized') | |
| doc = Nokogiri::HTML.parse(response.body, nil, nil) | |
| faces = doc.xpath('//*[@id="app"]/div[2]/div/div/div/a') | |
| names = [] | |
| faces.each do |face| | |
| name = face.attributes['title'].value.sub('@', '') | |
| url = face.attributes['data-source'].value |
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
| var script = document.createElement('script'); | |
| script.src = "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"; | |
| document.head.appendChild(script); |
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 java.util.Arrays; | |
| // Project Euler 154 | |
| // 479742450 | |
| // 59.7 seconds | |
| public class Problem154 { | |
| private static final int THT = 200000; // Two Hundred Thousand | |
| private int[] numOf2FactorsInFactorial = new int[THT + 1]; | |
| private int[] numOf5FactorsInFactorial = new int[THT + 1]; |
NewerOlder