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
| #!/usr/bin/env python3 | |
| """Monte Carlo simulation for burst photos with blink intervals.""" | |
| from __future__ import annotations | |
| import argparse | |
| import random | |
| # Parameter notes for photo use: |
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 Apollo | |
| public struct KCal: JSONDecodable, JSONEncodable { | |
| let value: Double | |
| public init(jsonValue value: Apollo.JSONValue) throws { | |
| guard let value = value as? Double else { throw JSONDecodingError.wrongType } | |
| guard (value.isZero || value.isNormal) && value >= 0.0 else { throw JSONDecodingError.couldNotConvert(value: value, to: KCal.self) } | |
| self.value = 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
| resource "aws_rds_cluster" "default" { | |
| cluster_identifier = "${var.service}-${var.name}-${var.env}" | |
| master_username = "${var.username}" | |
| master_password = "${var.password}" | |
| backup_retention_period = 5 | |
| preferred_backup_window = "19:30-20:00" | |
| preferred_maintenance_window = "wed:20:15-wed:20:45" | |
| port = 3306 | |
| vpc_security_group_ids = ["${var.security_group_ids}"] | |
| db_subnet_group_name = "${var.subnet_group_name}" |
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 projects = [ | |
| ['githubuser/repo1', 'circleci_api_token_for_repo1'], | |
| ['githubuser/repo2', 'circleci_api_token_for_repo2'], | |
| ]; | |
| var https = require('https') | |
| var callApi = function(method, path, body, callback) { | |
| var options = { | |
| hostname: 'circleci.com', |
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
| #!/usr/bin/env ruby | |
| SUBL_COMMAND = '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' | |
| require 'pathname' | |
| def base_dir | |
| return @base_dir if @base_dir | |
| return @base_dir = Pathname.new('.') if ARGV.empty? | |
| input = Pathname.new(ARGV[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
| on alfred_script(q) | |
| tell application "iTerm" to (create window with default profile) | |
| end alfred_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
| var https = require('https') | |
| exports.handler = function(event, context) { | |
| var options = { | |
| hostname: 'circleci.com', | |
| path: '/api/v1/project/${user|org}/${project}/tree/master?circle-token=${token}', | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| 'Accept': 'application/json' |
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
| a=readlines.map(&:strip).map(&:each_char).map(&:to_a) | |
| a[0]+=([nil]*100) | |
| puts a[0].zip(*a[1..-1]).flatten.join |
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/sh | |
| remove_dangling() { | |
| echo "Removing dangling images ..." | |
| docker rmi $(docker images -f dangling=true -q) | |
| } | |
| remove_stopped_containers() { | |
| echo "Removing stopped containers ..." | |
| docker rm $(docker ps -qa) |
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://www.softantenna.com/wp/software/5-programming-problems/ | |
| object Prob { | |
| def p1(list: List[Int]) = { | |
| def addRec(list: List[Int], acc: Int): Int = list match { | |
| case Nil => acc | |
| case x :: xs => addRec(xs, acc + x) | |
| } | |
| addRec(list, 0) | |
| } |
NewerOlder