Skip to content

Instantly share code, notes, and snippets.

View byrro's full-sized avatar

Renato Byrro byrro

View GitHub Profile
@jo
jo / js-crypto-libraries.md
Last active March 31, 2024 20:33
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@floer32
floer32 / aws_lambda_gotcha.md
Created October 16, 2015 21:21
A gotcha I ran into while playing with AWS Lambda.

I started out pasting Python code into the AWS Lambda web GUI, right in that textarea. Got it working, making a call to a Slack API (whee!). So I had a working test case and I could test a refactor.

With the same code, I wanted to take advantage of the cool zipfile/ virtualenv upload support ("Create a Deployment Package") so I could use third-party libraries. Keeping the code itself the same (same as what I'd pasted into the textarea), the test should work again, as long as I packaged it right.

I kept trying to upload a zip with the same code, I thought, to AWS Lambda ... but I kept getting an error:

@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@gsomoza
gsomoza / s3-presign-url.py
Last active August 6, 2018 12:45
S3: Create Presigned Download URL
#!/usr/bin/env python
# Usage:
# s3-presign-url path/to/object
#
# 1) Install boto3:
# pip install boto3
# 2) Configure aws:
# aws configure
# 3) Change the bucket name in this script (below)
@ulises-jeremias
ulises-jeremias / license-badges.md
Created February 24, 2017 14:36 — forked from lukas-h/license-badges.md
License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file. Easily copy and paste the code under the badges into your Markdown files.

Notes

  • Badges are made with Shields.io.
  • This badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Want to add a License?

Comment this gist or write me an E-Mail (lukas@himsel.me)

@mdonkers
mdonkers / server.py
Last active April 30, 2024 23:26
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@alexcasalboni
alexcasalboni / aws-lambda-static-type-checker.md
Last active May 22, 2023 07:31
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@auxten
auxten / Golang Elliptic Curve benchmark.md
Last active December 22, 2021 03:41
Golang Elliptic Curve benchmark
@MattUV
MattUV / expandable_text_edit.gd
Created February 8, 2019 13:13
Code to expand vertically a TextEdit node to fit the actual number of lines
extends TextEdit
export var expand = true
export var min_line = 3
export var max_line = 6
var scroll_bar
var font = get_font("")
var line_spacing

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,