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 'yaml' | |
| require 'oj' | |
| path = 'spec/vcr_cassettes/cassette.yml' | |
| loaded = YAML.load_file(path) | |
| body_string = loaded['http_interactions'][0]['response']['body']['string'] | |
| Oj.load(body_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
| # Usage: | |
| # | |
| # s3_bucket_size your-bucket-name | |
| # | |
| function s3_bucket_size() { | |
| if [ -z "$1" ]; then | |
| echo "Please provide a bucket name." | |
| return 1 | |
| fi |
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
| { | |
| "lv_module": { | |
| "prefix": "lv", | |
| "body": [ | |
| "defmodule ${WORKSPACE_NAME/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g}Web.${4}Live do", | |
| " use ${WORKSPACE_NAME/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g}Web, :live_view", | |
| "end", | |
| ], | |
| "description": "LiveView module" | |
| }, |
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 GooglePlayVerification | |
| require 'google/api_client' | |
| # Refer: | |
| # https://code.google.com/p/google-api-ruby-client/issues/detail?id=72 | |
| # and | |
| # http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html | |
| # and | |
| # http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/ | |
| GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.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 bash | |
| set -e | |
| echo | |
| if ! [[ $(id -u) = 0 ]]; then | |
| echo "Please run 'sudo ./install-wireguard.sh'" >&2 | |
| exit 1 | |
| fi | |
| read -e -p "Use VPN for *all* internet traffic? [y/n] " -i n ROUTE_ALL |
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
| version: 2 | |
| jobs: | |
| validate_terraform: | |
| docker: | |
| - image: hashicorp/terraform | |
| steps: | |
| - checkout | |
| - run: | |
| name: Validate Terraform Formatting |
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://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 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
| Verifying my Blockstack ID is secured with the address 183sRivGhZ3eMkoN4aJE2fS7j4kRpnHKd https://explorer.blockstack.org/address/183sRivGhZ3eMkoN4aJE2fS7j4kRpnHKd |
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
| # | |
| # Sample nginx.conf optimized for EC2 c1.medium to xlarge instances. | |
| # Also look at the haproxy.conf file for how the backend is balanced. | |
| # | |
| user "nginx" "nginx"; | |
| worker_processes 10; | |
| error_log /var/log/nginx_error.log info; |
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 re | |
| import boto3 | |
| import csv | |
| from botocore.exceptions import ClientError | |
| ec2 = boto3.client('ec2') | |
| def get_snapshots(): | |
| return ec2.describe_snapshots(OwnerIds=['self'])['Snapshots'] |
NewerOlder