Skip to content

Instantly share code, notes, and snippets.

Patrick Cable patcable

Block or report user

Report or block patcable

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@patcable
patcable / deploy.yml
Created Dec 16, 2019
Lambda CI assume-role and deploy
View deploy.yml
script:
- aws s3 cp code.zip s3://bucket/code_dev.zip --acl bucket-owner-full-control --region us-east-1
- DEPLOY_DEV_CREDS=$(aws sts assume-role --role-arn arn:aws:iam::ACCOUNT:role/lambda-deploy --role-session-name LambdaDeployer --duration-seconds 900 --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' --output json)
- export AWS_ACCESS_KEY_ID=$(echo -n $DEPLOY_DEV_CREDS | jq .[0] | tr -d \" | tr -d "\n")
- export AWS_SECRET_ACCESS_KEY=$(echo -n $DEPLOY_DEV_CREDS | jq .[1] | tr -d \" | tr -d "\n")
- export AWS_SESSION_TOKEN=$(echo -n $DEPLOY_DEV_CREDS | jq .[2] | tr -d \" | tr -d "\n")
- aws lambda update-function-code --region us-east-1 --function-name code --s3-bucket bucket --s3-key code_dev.zip
@patcable
patcable / certupdate.sh
Last active Jul 7, 2018
CloudKey Update Certificates
View certupdate.sh
#!/bin/bash
#
# certupdate.sh: renew a TLS cert and configure unifi cloudkey using Cloudflare
# DNS verification for ACME
#
# To use this script, make sure you have lego (https://github.com/xenolf/lego)
# on the machine. You'll need to do the first run on your own so you can agree
# to TOS and such.
# CLOUDFLARE_EMAIL: Email address for your cloudflare account
View 001_left-ipsec.conf
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
mobike=no
keyexchange=ikev2
View count_submission_length.rb
#!/usr/bin/env ruby
require 'httparty'
apikey = ENV['SM_API_KEY']
if apikey.nil?
puts "Need to set $SM_API_KEY - see https://<your_submission_site>.submittable.com/settings/api"
exit 1
end
### API SETTINGS
@patcable
patcable / org.homebrew.ssh-agent-logging.plist
Last active Mar 30, 2017
homebrew ssh-agent w/ opensc
View org.homebrew.ssh-agent-logging.plist
<!-- this is the plist with stdout/stderr logging enabled if you need it.
scroll down for the one without it. also remove this when you
copy and paste -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.homebrew.ssh-agent</string>
<key>ProgramArguments</key>
@patcable
patcable / 000_readme.md
Last active Dec 1, 2016
graylog2 editing permissions
View 000_readme.md

Editing permissions w/ Graylog

  • Goal: let devs create streams and search.
  • How: Post permissions to REST API

Useful tool: API browser. https://<grayloghost>/api/api-browser Can also CURL as well...

curl -v -XPUT -u ADMIN:PASSWORD -H 'Content-Type: application/json' 'http://graylog.example.org:9000/api/roles/rolename' -d 'collapsed_json_here'
View gist:9443750
### Keybase proof
I hereby claim:
* I am patcable on github.
* I am patcable (https://keybase.io/patcable) on keybase.
* I have a public key whose fingerprint is E927 DB61 4373 8AC2 CED8 6970 9643 FED3 0A2D A57A
To claim this, I am signing this object:
You can’t perform that action at this time.