Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
On shoulders of giants.

Carlos Guerrero guerrerocarlos

:octocat:
On shoulders of giants.
View GitHub Profile
@guerrerocarlos
guerrerocarlos / webcryptoapi.html
Created Aug 14, 2021 — forked from deiu/webcryptoapi.html
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
View webcryptoapi.html
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@guerrerocarlos
guerrerocarlos / ca.md
Created Aug 14, 2021 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@guerrerocarlos
guerrerocarlos / change-codec.md
Created Jul 7, 2021 — forked from dvf/change-codec.md
Enable High Quality mode on your headphones (Updated for macOS Catalina)
View change-codec.md

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@guerrerocarlos
guerrerocarlos / vpc-fargate.yaml
Created Jun 17, 2021 — forked from lizrice/vpc-fargate.yaml
Cloudformation template for setting up VPC and subnets for Fargate
View vpc-fargate.yaml
# Usage:
# aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml
# This template will:
# Create a VPC with:
# 2 Public Subnets
# 2 Private Subnets
# An Internet Gateway (with routes to it for Public Subnets)
# A NAT Gateway for outbound access (with routes from Private Subnets set to use it)
#
@guerrerocarlos
guerrerocarlos / deploy.sh
Created Jun 4, 2021 — forked from jed/deploy.sh
Using AWS CloudFormation to deploy an edge lambda
View deploy.sh
#!/bin/sh
aws cloudformation deploy \
--template-file stack.yaml \
--stack-name edge-lambda-test \
--capabilities CAPABILITY_IAM \
--parameter-overrides Nonce=$RANDOM
@guerrerocarlos
guerrerocarlos / traceroute.js
Created Feb 7, 2021 — forked from liamgriffiths/traceroute.js
traceroute clone in javascript
View traceroute.js
// sloppy traceroute clone
// inpired by https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your
// and made possible by https://www.npmjs.org/package/raw-socket
var raw = require('raw-socket');
var dns = require('dns');
var target = process.argv[2] || '173.230.146.29';
var MAX_HOPS = 64;
var TIME_LIMIT = 5000;
@guerrerocarlos
guerrerocarlos / serverless_domain_manager.json
Created Dec 29, 2020
Generic serverless-domain-manager IAM policy
View serverless_domain_manager.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:POST"
],
"Resource": "*"
},
@guerrerocarlos
guerrerocarlos / serverless-deploy-iam.json
Created Dec 29, 2020
Generic `sls deploy` IAM policy
View serverless-deploy-iam.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:List*",
"cloudformation:Get*",
"cloudformation:ValidateTemplate",
"cloudformation:CreateStack",
View OIDC_google_issuer.json
{
"claim_types_supported": ["normal"],
"claims_parameter_supported": false,
"grant_types_supported": [
"authorization_code",
"refresh_token",
"urn:ietf:params:oauth:grant-type:device_code",
"urn:ietf:params:oauth:grant-type:jwt-bearer"
],
"request_parameter_supported": false,
View di_ping.sh
{
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-nyc1.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-nyc2.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-nyc3.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-ams2.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-ams3.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-sfo1.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-sfo2.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-sgp1.digitalocean.com/
curl -w "%{url_effective};%{time_connect}\n" -o /dev/null -s http://speedtest-lon1.digitalocean.com/