Skip to content

Instantly share code, notes, and snippets.

View sekmet's full-sized avatar
📡
If you are going to TRY, go ALL the WAY!

Carlos Guimaraes sekmet

📡
If you are going to TRY, go ALL the WAY!
View GitHub Profile
@sekmet
sekmet / llm.py
Created October 28, 2023 19:23 — forked from disler/llm.py
Python LLM Starter Module
"""
Purpose:
Interact with the OpenAI API.
Provide supporting prompt engineering functions.
"""
import sys
from dotenv import load_dotenv
import os
from typing import Any, Dict
@sekmet
sekmet / shopfiy_translate_buy_now_button.html
Created October 16, 2023 14:04 — forked from vvkh/shopfiy_translate_buy_now_button.html
Translate "buy now" button in Shopify
<script>
// Add this snippet to the page with the "buy now" button.
// If you need dynamic translation to different languages,
// add products.product.buy_now translation to the locales file.
// Otherwise replace {{'products.product.buy_now' | t }} with desired translation.
const intervalTime = 100;
function updateButton() {
const paymentButton = document.querySelector('[data-testid="Checkout-button"]');
if (paymentButton !== null) {
@sekmet
sekmet / gist:8cdaf4ad43e9ae7edbb63d02ea7d3fff
Created April 25, 2023 18:33
A list of countries as Select->Option
<select>
<option value="AF">Afghanistan</option>
<option value="AX">Åland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">AndorrA</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
@sekmet
sekmet / LLM.md
Created March 29, 2023 01:55 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@sekmet
sekmet / steps.md
Created January 16, 2023 02:10 — forked from mraaroncruz/steps.md
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

New improved next steps

  1. Go to https://web.telegram.org
  2. Click on your channel
  3. Look at the URL and find the part that looks like c12112121212_17878787878787878
  4. Remove the underscore and after c12112121212
@sekmet
sekmet / TimedBallot.sol
Created May 1, 2022 05:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.13+commit.abaa5c0e.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract TimedBallot {
@sekmet
sekmet / HelloWorld.sol - zku2022
Created May 1, 2022 03:11
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.13+commit.abaa5c0e.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract HelloWorld {
// a variable to store a number
uint public number;
// function to store an unsigned integer
function storeNumber(uint _number) public {
number = _number;

How to setup a practically free CDN

I've been using [Backblaze][bbz] for a while now as my online backup service. I have used a few others in the past. None were particularly satisfactory until Backblaze came along.

It was - still is - keenly priced at a flat $5 (£4) per month for unlimited backup (I've currently got just under half a terabyte backed-up). It has a fast, reliable client. The company itself is [transparent about their operations][trans] and [generous with their knowledge sharing][blog]. To me, this says they understand their customers well. I've never had reliability problems and everything about the outfit exudes a sense of simple, quick, solid quality. The service has even saved the day on a couple of occasions where I've lost files.

Safe to say, I'm a happy customer. If you're not already using Backblaze, [I highly recommend you do][recommend].

Taking on the big boys with B2

// This is universal, works with Infura -- set provider accordingly
const ethers = require('ethers')
//const provider = ethers.getDefaultProvider('rinkeby')
const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL)
function hex_to_ascii(str1) {
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {