Skip to content

Instantly share code, notes, and snippets.

@ericson-cepeda
ericson-cepeda / send-get-request-to-opensearch-using-curl-with-sigv4.sh
Created March 22, 2024 20:17 — forked from hassaku63/send-get-request-to-opensearch-using-curl-with-sigv4.sh
Send GET request to OpenSearch Domain using curl with sig4 signature
aws_region='ap-northeast-1'
endpoint="https://DOMAIN_NAME.${aws_region}.es.amazonaws.com/"
AWS_ACCESS_KEY_ID='foo'
AWS_SECRET_ACCESS_KEY='bar'
curl $endpoint --verbose --aws-sigv4 "aws:amz:${aws_region}:es" --user "${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}"
@ericson-cepeda
ericson-cepeda / query_athena.py
Created September 26, 2022 23:21 — forked from EdwardJRoss/query_athena.py
Showing different ways to query data from Athena
#!/usr/bin/env python
"""Exploring different ways to fetch data from Athena"""
from decimal import Decimal
import codecs
import datetime
import random
import string
from urllib.parse import urlparse
import pytz
from boto3.session import Session
@ericson-cepeda
ericson-cepeda / README.md
Created August 3, 2021 11:52 — forked from twolfson/README.md
Setting up SOPS

I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.

PGP

It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)

This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.

Web of trust

Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.

This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.

@ericson-cepeda
ericson-cepeda / jenkins-api.md
Created May 28, 2020 19:38 — forked from justlaputa/jenkins-api.md
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@ericson-cepeda
ericson-cepeda / settings.py
Created May 11, 2020 23:14 — forked from psviderski/settings.py
Python structlog with Sentry and Logstash integration
# This list contains all the attributes listed in
# http://docs.python.org/library/logging.html#logrecord-attributes
LOG_RECORD_ATTRIBUTES = {
'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename',
'funcName', 'levelname', 'levelno', 'lineno', 'message', 'module',
'msecs', 'msg', 'name', 'pathname', 'process', 'processName',
'relativeCreated', 'stack_info', 'thread', 'threadName',
}
BASIC_TYPES = (str, bool, int, float, type(None))
@ericson-cepeda
ericson-cepeda / git_submodules.md
Created March 10, 2020 10:39 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@ericson-cepeda
ericson-cepeda / lets-encrypt-route53.rb
Created July 31, 2019 22:16 — forked from joshgarnett/lets-encrypt-route53.rb
Ruby script to use as a hook for the letsencrypt.sh client
#!/usr/bin/env ruby
require 'aws-sdk'
#
# This script requires you to have the following environment variables set:
# AWS_REGION="us-west-2"
# AWS_ACCESS_KEY_ID="<YOUR_KEY>"
# AWS_SECRET_ACCESS_KEY="<YOUR_SECRET_KEY>"
#
@ericson-cepeda
ericson-cepeda / .credentials
Created June 13, 2019 08:42 — forked from vrischmann/.credentials
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
{
"swagger": "2.0",
"info": {
"description": "Access log traverser",
"version": "1.0.0",
"title": "Log Traverser",
"contact": {
"email": "ericson.cepeda@gmail.com"
},
"license": {
@ericson-cepeda
ericson-cepeda / client.py
Created February 18, 2019 13:31 — forked from kylehounslow/client.py
Send and receive images using Flask, Numpy and OpenCV
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
headers = {'content-type': content_type}