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
import boto3 | |
import json | |
# Create CloudWatchLogs client | |
cloudwatch_logs = boto3.client('logs') | |
paginator = cloudwatch_logs.get_paginator('describe_log_groups') | |
subscription_details = {} | |
for response in paginator.paginate(): | |
for logGroup in response['logGroups']: | |
log_group_name = logGroup['logGroupName'] | |
subscription_filters = cloudwatch_logs.describe_subscription_filters(logGroupName = log_group_name) |
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
echo "1234567890" | cut -b 1-6 |
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
echo "1234567890" | cut -b 1-6 |
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
FROM alpine:3.9 | |
RUN apk --no-cache add ca-certificates wget bash \ | |
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ | |
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk \ | |
&& apk add glibc-2.29-r0.apk | |
RUN wget https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.69.0/pact-1.69.0-linux-x86_64.tar.gz \ | |
&& tar xzf pact-1.69.0-linux-x86_64.tar.gz \ | |
&& rm -rf pact-1.69.0-linux-x86_64.tar.gz |
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
class LoginPage { | |
func login(with userName: String, and password: String): SomeOtherPage { | |
return XCTContext.runActivity("Login as existing user") { | |
this.enter(userName: userName) | |
this.enter(password: password) | |
this.submit() | |
return new SomeOtherPage(app: this.app); | |
} | |
} |
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
import Foundation | |
public extension Array { | |
public func randomItem() -> Element? { | |
guard self.count > 0 else { | |
return nil | |
} | |
let index = Int(arc4random_uniform(UInt32(self.count))) |
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
import json | |
capitals = json.load(open('capital.json')) | |
currency = json.load(open('currency.json')) | |
iso3 = json.load(open('iso3.json')) | |
names = json.load(open('names.json')) | |
phone = json.load(open('phone.json')) | |
countries = {} |
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
package com.sabrelabs.twitter.auth | |
import scala.collection.BitSet | |
import scala.annotation.tailrec | |
import scala.runtime.RichInt | |
import scala.collection.mutable.ListBuffer | |
object PercentEncoder { | |
def encodeRFC3986(str: String): String = { |
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
class NumberToWordConverter { | |
private val specialNames = arrayOf("", " thousand", " million", " billion", " trillion", " quadrillion", " quintillion") | |
private val tensNames = arrayOf("", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety") | |
private val numNames = arrayOf("", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen") | |
private fun convertLessThanOneThousand(number: Int): String { | |
var number = number | |
var current: String |
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
#!/bin/bash | |
brew_command=/usr/local/bin/brew | |
brew_cask_command="$brew_command cask" | |
echo '#!/bin/bash' | |
echo '' | |
echo 'trap ctrl_c INT' | |
echo 'function ctrl_c() {' | |
echo 'echo "** Trapped CTRL-C"' |