Skip to content

Instantly share code, notes, and snippets.

View Lucs1590's full-sized avatar
🤜
Hard Work!

Lucas Brito Lucs1590

🤜
Hard Work!
View GitHub Profile
@Lucs1590
Lucs1590 / plot_activation_functions.ipynb
Created January 25, 2024 21:56
How to plot activation functions with Python. Sigmoid, Tanh, ReLU, Leaky ReLU, Softmax.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Lucs1590
Lucs1590 / bt-profile-switch.sh
Created July 3, 2023 17:04
Bash script to switch between A2DP and Hands-Free profiles for a Bluetooth audio device, providing error handling and flexibility to listen or speak.
#!/bin/bash
CARD=$(pactl list | grep bluez_card | awk '{print $NF}')
BLUETOOTH_DEVICE=$(pacmd list-sinks | grep -o '<bluez_sink[^>]*' | awk -F "<" '{print $2}' | awk -F ">" '{print $1}')
PROFILE_A2DP="a2dp_sink"
PROFILE_HEADSET_UNIT="handsfree_head_unit"
set_profile() {
local profile=$1
@Lucs1590
Lucs1590 / wacom-monitor-switch.sh
Created July 3, 2023 17:02
Bash script to set the output monitor for Wacom devices, providing security checks, error handling, and flexibility, allowing easy configuration with a specific monitor.
#!/bin/bash
# set -euo pipefail
# Check if monitor number was provided as an argument
if [[ $# -eq 0 ]]; then
echo "Please provide the monitor number as an argument."
echo "Usage: $0 <monitor_number>"
exit 1
fi
@Lucs1590
Lucs1590 / create_zip_chunks.py
Created December 1, 2022 14:08
How to save zip file chunks according to a batch of files.
import os
import zlib
import zipfile
from glob import glob
def compress(file_names: list):
compression = zipfile.ZIP_STORED
store_chunk_limit = 1_000_000_000 # 1 GB
@Lucs1590
Lucs1590 / Dockerfile
Created September 19, 2022 20:49
A docker file with R, Java, Python and AWS.
FROM python:3.8-slim-buster
COPY ./requirements.txt /app/requirements.txt
COPY . /app
WORKDIR /app
#JAVA CONFIG
RUN apt-get update
RUN apt-get install -y apt-utils \
@Lucs1590
Lucs1590 / app.component.ts
Last active July 22, 2022 02:16
This is a code to create the main page with the translation resource.
import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { lastValueFrom } from 'rxjs';
import { ApiService } from './api.service';
@Component({
selector: 'app-root',
template: `
<div>
<h1 translate> mainPhrase </h1>
@Lucs1590
Lucs1590 / api.service.ts
Created July 22, 2022 00:40
Service to connect with an API that provides the user's IP.
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ApiService {
@Lucs1590
Lucs1590 / pt.json
Last active July 22, 2022 00:01
File with portuguese translations.
{
"mainPhrase": "Essa é a frase principal.",
"subPhrase": "Essa é a subfrase.",
"buttonPhrase": "en"
}
@Lucs1590
Lucs1590 / en.json
Last active July 22, 2022 00:01
File with english translations.
{
"mainPhrase": "This is the main phrase.",
"subPhrase": "This is the sub phrase.",
"buttonPhrase": "pt-BR"
}
@Lucs1590
Lucs1590 / app.module.ts
Last active July 21, 2022 21:18
Module with translate service.
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AppComponent } from './app.component';
@NgModule({