Skip to content

Instantly share code, notes, and snippets.

View byrro's full-sized avatar

Renato Byrro byrro

View GitHub Profile
@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)
@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:

@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
@eladroz
eladroz / arrow2-graviton2.md
Last active August 12, 2022 06:09
Packaging Apache Arrow 2.0 on AWS Graviton2 (ARM64)

I'm now working on big data processing with Pandas at scale, as a lightweight alternative to Spark. Fortunately, the Apache Arrow project brings with it an excellent and very fast Parquet reader and writer.

With the current push to ARM in both personal computers and the data center, I was curious to check the performance of my code on ARM - running on AWS' homegrown Graviton2 processor. Their c6g instance types are 20% cheaper than the equivalent Intel-based c5's, while promising faster performance. If that's the future, why not start getting ready now?

While there are already Python wheels for NumPy and Pandas, there is no official build yet for PyArrow. There's a pull request in the works,

@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)

@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:

@Birch-san
Birch-san / fine-tuning.md
Last active December 27, 2023 17:24
Fine-tuning LLaMA-7B on ~12GB VRAM with QLoRA, 4-bit quantization

Fine-tuning LLaMA-7B on ~12GB VRAM with QLoRA, 4-bit quantization

nvidia-smi said this required 11181MiB, at least to train on the sequence lengths of prompt that occurred initially in the alpaca dataset (~337 token long prompts).
You can get this down to about 10.9GB if (by modifying qlora.py) you run torch.cuda.empty_cache() after PEFT has been applied to your loaded model and before you begin training.

Setup

All instructions are written assuming your command-line shell is bash.

Clone repository:

@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
@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.