Skip to content

Instantly share code, notes, and snippets.

View Markkop's full-sized avatar
Keeping up with AI

Marcelo Kopmann Markkop

Keeping up with AI
View GitHub Profile
@Markkop
Markkop / create-pull-request.sh
Created June 5, 2024 16:39
create-pull-request.sh
#!/bin/bash
# This script automates the creation of a GitHub pull request with information extracted from the current git branch name.
# It expects the branch name to contain a JIRA issue ID followed by a descriptive title.
# The script will:
# 1. Extract the JIRA issue ID from the branch name.
# 2. Format the title from the branch name.
# 3. Prompt the user to classify the issue as a bug or feature.
# 4. Prompt the user to select the target branch for the pull request.
# 5. Create the pull request using the GitHub CLI (`gh`).
@Markkop
Markkop / gmail-to-zoho-invoice-generator.js
Created June 4, 2024 23:27
gmail-to-zoho-invoice-generator.js
// ==UserScript==
// @name Invoice Generator for Gmail
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Generate invoices automatically from Gmail content and send to Zoho
// @author Mark Kop
// @match https://mail.google.com/*
// @match https://oauth.pstmn.io/v1/callback
// @grant GM_xmlhttpRequest
// @grant GM_setValue
@Markkop
Markkop / prompt.md
Last active April 14, 2023 14:39
A ChatGPT prompt to create a React progress bar component

Create a React component with tailwind for me.

It is a progress bar to track the user's progress level.
The text and the vertical line must be at the end of the current progress bar.
The background is transparent.

The component has this ASCII representation:

                            │
                            │
@Markkop
Markkop / fipe.js
Last active April 11, 2023 17:02
Show FIPE Price on WebMotors Car Card
// ==UserScript==
// @name Show FIPE Price on WebMotors Car Card
// @namespace Violentmonkey Scripts
// @match https://www.webmotors.com.br/*
// @grant none
// @version 1.0
// @author Marcelo "Mark" Kopmann
// ==/UserScript==
(async () => {
@Markkop
Markkop / fipe.js
Created April 11, 2023 03:25
Get FIPE Table value and displays it on top of the current price
(async () => {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const processVehicleCard = async (vehicleCard) => {
const title = vehicleCard.querySelector('h2').innerText;
const subTitle = vehicleCard.querySelector('h3').innerText;
const [make, model] = title.split(' ');
const imgAlt = vehicleCard.querySelector('img').alt;
@Markkop
Markkop / createPullRequest.sh
Created March 31, 2023 16:48
Bash script to create a PR using the current branch name
#!/bin/bash
branch_name=$(git rev-parse --abbrev-ref HEAD)
jira_id_lowercase=$(echo "$branch_name" | grep -o -E '[a-zA-Z]+-[0-9]+' | head -n1)
jira_id_uppercase=$(echo "$jira_id_lowercase" | tr '[:lower:]' '[:upper:]')
title=$(echo "$branch_name" | sed -E "s/$jira_id_lowercase-([^-]+.*)/\1/g" | sed 's/-/ /g')
title="${title#* }" # remove first word (feature/hotfix/etc)
if [[ -z "$jira_id_lowercase" ]]; then
@Markkop
Markkop / setup.md
Last active September 20, 2023 19:21
Mark's Dev Setup
@Markkop
Markkop / compareDownloads.js
Created July 30, 2022 22:22
Compare webpage course videos with the downloaded files to check if you didn't miss one
var fs = require('fs');
// Use this to obtain the video names and copy the resulting array
// [...document.querySelectorAll('.heading h3')].map(el => el.innerText).sort((a,b) => (a.localeCompare(b)))
// Paste and assing the array to this variable
const webVideos = []
function compareDownloads() {
try {
// This works
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.0;
contract AttackKing {
function attack(address payable _kingAddress) public payable {
(bool success,) = _kingAddress.call.gas(10000000).value(msg.value)("");
require(success, "Failed to send value!");
}
}
@Markkop
Markkop / GasSaverRewards.sol
Created April 15, 2022 02:27
A gas saver implementation for the calculating staking rewards
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./RewardToken.sol";
contract StakingManager is Ownable{