Skip to content

Instantly share code, notes, and snippets.

View oscarnevarezleal's full-sized avatar

Oscar Nevarez oscarnevarezleal

View GitHub Profile
@oscarnevarezleal
oscarnevarezleal / Dockerfile
Created May 8, 2024 23:17
Custom CMD handler based on environment variables
FROM public.ecr.aws/lambda/python:3.9
ARG HANDLER_PATH="src.entrypoints.listener.handler.handler"
ENV HANDLER_PATH="${HANDLER_PATH}"
#....
ENTRYPOINT [ "./lambda-entrypoint.sh" ]
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_q_lora.down.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_q_lora.up.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_k_lora.down.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_k_lora.up.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_v_lora.down.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_v_lora.up.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_out_lora.down.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn1.processor.to_out_lora.up.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn2.processor.to_q_lora.down.weight
key=down_blocks.0.attentions.0.transformer_blocks.0.attn2.processor.to_q_lora.up.weight
key=lora_te_text_model_encoder_layers_0_mlp_fc1.alpha
key=lora_te_text_model_encoder_layers_0_mlp_fc1.lora_down.weight
key=lora_te_text_model_encoder_layers_0_mlp_fc1.lora_up.weight
key=lora_te_text_model_encoder_layers_0_mlp_fc2.alpha
key=lora_te_text_model_encoder_layers_0_mlp_fc2.lora_down.weight
key=lora_te_text_model_encoder_layers_0_mlp_fc2.lora_up.weight
key=lora_te_text_model_encoder_layers_0_self_attn_k_proj.alpha
key=lora_te_text_model_encoder_layers_0_self_attn_k_proj.lora_down.weight
key=lora_te_text_model_encoder_layers_0_self_attn_k_proj.lora_up.weight
key=lora_te_text_model_encoder_layers_0_self_attn_out_proj.alpha
@oscarnevarezleal
oscarnevarezleal / install.sh
Last active February 8, 2023 20:21
Install docker-compose plugin
curl -o docker-compose -L "https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-$(uname -i)"
mkdir -p ~/.docker/cli-plugins
cp ./docker-compose ~/.docker/cli-plugins/docker-compose
sudo chmod +x ~/.docker/cli-plugins/docker-compose
docker help
{
"identifiers":{
"email":"[email protected]",
"uuid": "1x2y3z",
"custom": {
"user_loyalty_id":"xyz123"
}
},
"attributes":{
"email_optin":true,
func getBuildpackName(context packit.BuildContext) (string, error) {
var conf packit.BuildpackInfo
if _, err := toml.DecodeFile(filepath.Join(context.CNBPath, "buildpack.toml"), &conf); err != nil {
return "", err
}
return conf.Name, nil
}
@oscarnevarezleal
oscarnevarezleal / amplifyPush
Created July 12, 2021 16:07
This is the amplifyPush script
#!/usr/bin/env bash
set -e
IFS='|'
help_output() {
echo "usage: amplify-push <--environment|-e <name>> <--simple|-s>"
echo " --environment The name of the Amplify environment to use"
echo " --simple Optional simple flag auto-includes stack info from env cache"
exit 1
}
init_env() {
@oscarnevarezleal
oscarnevarezleal / clean-up-cloudmap.sh
Created February 1, 2021 18:32
Clean up AWS Cloudmap Namespace
# This cleans every cloudmap and every service
# from https://www.appmeshworkshop.com/cleanup/cloudmap/
NAMESPACE=$(aws servicediscovery list-namespaces | \
jq -r ' .Namespaces[] |
select ( .Properties.HttpProperties.HttpName == "appmeshworkshop.pvt.local" ) | .Id ');
SERVICE_ID=$(aws servicediscovery list-services --filters Name="NAMESPACE_ID",Values=$NAMESPACE,Condition="EQ" | jq -r ' .Services[] | [ .Id ] | @tsv ' )
aws servicediscovery list-instances --service-id $SERVICE_ID | jq -r ' .Instances[] | [ .Id ] | @tsv ' |\
while IFS=$'\t' read -r instanceId; do
@oscarnevarezleal
oscarnevarezleal / SimpleErrorController.java
Created September 20, 2019 03:06
SimpleErrorController.java for SpringBot v2.0
package com.app.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.WebRequest;
{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata": {
"AWS::CloudFormation::Designer": {
"efe6e8a5-83b8-44fe-9a93-c3ea86b57fe7": {
"size": {
"width": 60,
"height": 60
},
"position": {