Skip to content

Instantly share code, notes, and snippets.

View padolsey's full-sized avatar

James Padolsey padolsey

View GitHub Profile
Law n. 13,709/2018 – Provides for the
protection of personal data and changes Law
n. 12,965/2014 (Brazilian Civil Rights
Framework for the Internet)
THE NATIONAL CONGRESS decrees:
CHAPTER I
PRELIMINARY PROVISIONS
Article 1 This Law provides on the processing of personal data, including by digital means, by a natural
person or legal entity governed by public or private law, for the purpose of protecting the essential rights
of freedom and privacy and the free development of the personality of the individuals.
class TagStreamProcessor {
constructor(startTag, endTag, placeholder, processFn) {
this.startTag = startTag;
this.endTag = endTag;
this.placeholder = placeholder;
this.process = processFn;
this.buffer = '';
this.tagOpen = false;
}
import json
import re
import base64
import openai
from openai import OpenAI
from threading import Lock
with open('keys.json', 'r') as file:
api_keys = json.load(file)
// Creating a new MutationObserver to watch for changes in the attributes of an image element
new MutationObserver(changes => {
// Iterating through each change detected by the observer
changes.forEach(change => {
// Check if the change is related to the 'src' attribute of the image
if(change.attributeName.includes('src')){
console.log(change.target.src); // Logging the new source of the image
// Attempt to find an existing clone image by its ID
let i = document.querySelector('#img-clone-transparent');
import requests
import threading
import time
import csv
import os
import random
from collections import defaultdict
api_key = os.environ.get('OPENAI_API_KEY')
word_freq = defaultdict(int)
@padolsey
padolsey / mastodon_linker.js
Created November 19, 2022 22:06
Be careful.....
// ==UserScript==
// @name Mastodon Link To Own Instance
// @version 0.1
// @description Adds link to your own instance next to a mastadon
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
/**
* I reckon computed member access in JS, i.e. ...[...],
* could be a tonne more powerful. This is an example of that.
* ===========================================================
* This is a filthy hack. Probably don't use it...
* ===========================================================
* It sets up a proxy that'll catch member access to arrays.
* Upon member-access, toString will be natively called and
* intercepted; the intercepted value will be used within our
* proxy to return a filtered version of the array.
Number.prototype.to = function*(n) {
let finish = n.valueOf();
let start = this.valueOf();
let finishLessThan = start >= finish;
for (
let i = start;
finishLessThan ? i >= finish: i <= finish;
i += finishLessThan ? -1 : +1
) yield i;
};

Keybase proof

I hereby claim:

  • I am padolsey on github.
  • I am padolsey (https://keybase.io/padolsey) on keybase.
  • I have a public key whose fingerprint is F256 45CF 1A20 5360 6A46 A9AD 599B 1D48 053D 0BD2

To claim this, I am signing this object:

'use strict'
const five = require('johnny-five');
const board = new five.Board();
board.on('ready', () => {
console.log('Ready');
let lcd = new five.LCD({