Skip to content

Instantly share code, notes, and snippets.

View kenpropel's full-sized avatar
:octocat:
Gitty…

Ken kenpropel

:octocat:
Gitty…
View GitHub Profile
@kenjij
kenjij / openssl.sh
Last active April 29, 2022 20:42
OpenSSL SSL certificate generation process
# Generate private key with passphrase
openssl genrsa -des3 -out server.key 2048
# Private key without passpharase; UNDERSTAND THE RISK!
openssl rsa -in server.key -out server.key-nopass
# Generate CSR to submit to CA
openssl req -new -sha256 -key server.key -out server.csr
# Check/view CSR
@kenjij
kenjij / slack_formatting.md
Created December 28, 2016 08:58
Slack message formatting to be used with their API

Slack Message Formatting Reference

Text Formatting

Basic Styles

Making a *bold statement.*
Emphasis with _italic text._
Let's ~strike out~ post this message.
@kenjij
kenjij / CHANGELOG.md
Created December 29, 2016 09:12
A change log template

1.0.0 / Unreleased

Added

  • Version followed by release date.
  • Maintain "Unreleased" version in draft in preparation for release.
  • "Added" section for new features added.
  • MAJOR increment in semantic versioning would mean incompatible changes.

Changed

@kenjij
kenjij / clean-sidekiq-stats.sh
Created January 11, 2017 05:05
Clean up Sidekiq stats in Redis
redis-cli KEYS "Sidekiq:*:stat:processed:*" | xargs -n 100 redis-cli DEL
@kenjij
kenjij / rvm_admin.sh
Created January 21, 2017 00:24
RVM administration
# See: https://rvm.io/rvm/install
# Install public key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
# Single-user install
\curl -sSL https://get.rvm.io | bash -s stable --ruby
# Multi-user install; after install, add users to "rvm" group
\curl -sSL https://get.rvm.io | sudo bash -s stable
@jeshan
jeshan / get-lambda-event-source.js
Last active June 13, 2024 10:25
AWS Lambda: Determine Event Source from event object. Note that this is an approximation as anybody can send a payload that resembles the real thing.
function getLambdaEventSource(event) {
if (event.Records && event.Records[0].cf) return 'isCloudfront';
if (event.configRuleId && event.configRuleName && event.configRuleArn) return 'isAwsConfig';
if (event.Records && (event.Records[0].eventSource === 'aws:codecommit')) return 'isCodeCommit';
if (event.authorizationToken === "incoming-client-token") return 'isApiGatewayAuthorizer';
if (event.StackId && event.RequestType && event.ResourceType) return 'isCloudFormation';
@kenjij
kenjij / Firebase.md
Last active May 24, 2024 14:02
Firebase REST authentication
@kenjij
kenjij / Slack.md
Last active June 13, 2019 07:33
Slack access token for bots (OAuth)

Slack OAuth for Bot App

1. Autorization

Open in a web browser: https://slack.com/oauth/authorize?scope=bot&client_id=12345.67890

  • Use Client ID from App Credentials.
  • Use bot for scope.

2. Authorization Code

@kenjij
kenjij / Makefile
Created February 7, 2020 06:00
Build and Package RubyGems for AWS Lambda Layer Use (example)
#
# Build and Package RubyGems for AWS Lambda Layer Use
#
all: build package
build:
gem i firebase-ruby -Ni ruby/gems/2.5.0
gem i darksky-ruby -Ni ruby/gems/2.5.0
ls -m ruby/gems/2.5.0/gems
@kenjij
kenjij / GET.json
Created February 7, 2020 07:48
Sample: AWS Lambda function event contents received from API Gateway (HTTP API; route: "/event")
{
"version":2,
"path":"/event",
"httpMethod":"GET",
"headers":{
"Content-Length":"0",
"Host":"abcde12345.execute-api.us-west-2.amazonaws.com",
"User-Agent":"curl/7.54.0",
"X-Amzn-Trace-Id":"Root=1-67891233-abcdef012345678912345678",
"X-Forwarded-For":"192.168.1.23",