Skip to content

Instantly share code, notes, and snippets.

View arturmartins's full-sized avatar
💭
I may be slow to respond.

Artur Martins arturmartins

💭
I may be slow to respond.
View GitHub Profile
@arturmartins
arturmartins / Token.sol
Created April 3, 2024 14:55
Chainlink Bootcamp - Day 3
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts@4.6.0/access/AccessControl.sol";
contract Token is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() ERC20("Chainlink Bootcamp 2024 Token", "CLBoot24") {
@arturmartins
arturmartins / webvtt2txt.py
Created October 26, 2023 10:53
Converts WEBVTT subtitles (vtt) to plain text.
#!/usr/bin/env python3
"""
Converts WEBVTT subtitles (vtt) to plain text.
It removes all time related info as well as duplicated and empty lines.
"""
# Author: Artur Martins <arturmartins@gmail.com>
# Version: 1.0
# Date: 2023-Oct-25
@arturmartins
arturmartins / etcd_install.sh
Created October 8, 2023 22:01
Script to download and install etcd for linux amd64
#!/bin/bash
# Utility to download latest etcd version for linux
SYSTEM_VERSION="linux-amd64"
fail(){
echo "[${0##*/}]: FATAL: ${@}"
exit 1
}
@arturmartins
arturmartins / HelloWorld-2.sol
Last active July 14, 2023 16:11
Ethereum smart contract with set/get (not pure)
pragma solidity 0.8.20;
contract HelloWorld2{
string userInput;
function set(string memory finalValue) public
{
userInput = finalValue;
}
@arturmartins
arturmartins / HelloWorld.sol
Created July 14, 2023 16:04
Ethereum Smart Contract - HelloWorld example
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
// This defines a contract named “HelloWorld”.
//
// A contract is a collection of functions and data (its state).
// Once deployed, a contract will exist at an address on the Ethereum blockchain.
contract HelloWorld {
// This is a public function that returns the string “Hello World”.
@arturmartins
arturmartins / mac-upgrade.sh
Last active March 7, 2024 03:09
How to keep your mac software updated easily (2023)
#!/bin/bash
# Requirements:
# - homebrew: https://brew.sh/
# - homebrew tap: buo/cask-upgrade - https://github.com/buo/homebrew-cask-upgrade
# - homebrew mas (Mac App Store command-line interface - https://github.com/mas-cli/mas)
BREWFILE="${HOME}/Brewfile"
# Update, upgrade all and cleanup
brew update && brew upgrade && brew cu --all --yes --cleanup && mas upgrade && brew cleanup
@arturmartins
arturmartins / postgres_queries_and_commands.sql
Created April 25, 2018 21:14 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@arturmartins
arturmartins / keybase.md
Created April 13, 2018 23:16
Keybase proof

Keybase proof

I hereby claim:

  • I am arturmartins on github.
  • I am arturmartins (https://keybase.io/arturmartins) on keybase.
  • I have a public key whose fingerprint is 5AD7 E464 F268 A96C A0DC B5B9 0BF4 27DB 2701 2336

To claim this, I am signing this object:

@arturmartins
arturmartins / TCD-install-Bradford-Dissolvable-Agent.md
Created June 24, 2016 15:55
Install TCD Bradford Dissolvable Agent on MAC Yosemite

Instructions how to install the TCD Bradford Dissolvable Agent

(Trinity College Dublin (TCD) on a MACOS Yosemite)

  1. Download the zip file into Downloads folder
  2. Extract the zip file (Downloads/Bradford_Dissolvable_Agent.app)
  3. Open a terminal windown and run the command
sudo Downloads/Bradford_Dissolvable_Agent.app/Contents/MacOS/DissolvableAgent
@arturmartins
arturmartins / install_bucardo.sh
Created February 24, 2016 11:34
Install bucardo 5.4.1 in ubuntu 12.04 / 14.04 LTS
#!/bin/bash
# Based on the instructions in
# https://bucardo.org/wiki/Bucardo/Installation
# -------- configuration: Variables
BUCARDO_VERSION='5.4.1'
DOWNLOAD_URL="http://bucardo.org/downloads/Bucardo-${BUCARDO_VERSION}.tar.gz"
# -------------------------------
TEMP_FILE="/tmp/${RANDOM}.tar.gz"