Skip to content

Instantly share code, notes, and snippets.

@maxwellamaral
maxwellamaral / profile.ps1
Last active July 6, 2024 14:48
Alterar diretório no sistema Johnny Decimal no Powershell | Change directory on Johnny Decimal system on Powershell
function cdj {
param (
[string]$folderName
)
# Atualize com a pasta raiz dos seus documentos
$rootPath = "D:\Cloud\OneDrive"
# Lista de diretórios correspondentes ao padrão
$matchingDirs = Get-ChildItem -Path $rootPath -Directory -Recurse | Where-Object { $_.Name -like "*$folderName*" }
@rileywong311
rileywong311 / GSOC2023.md
Last active September 7, 2023 19:13
Riley Wong's Google Summer of Code 2023 with BRL-CAD, IfcOpenShell
import os
import assemblyai as aai
from pytube import YouTube
aai.settings.api_key = "INSERT YOUR API KEY HERE"
youtube_url = "https://www.youtube.com/watch?v=f94wKh70cOY"
# Let's download the YouTube video
youtube = YouTube(youtube_url)
audio = youtube.streams.filter(only_audio=True).first()
@xagronaut
xagronaut / README.md
Last active September 29, 2022 15:07
Generate Markdown from OneTab Chrome extension (requires dev tools console)

OneTab to Markdown

This snippet generates a Markdown link list from groups of tabs saved by the OneTab Chrome extension. You must run this snippet from the Chrome Developer Tools by right-clicking the page and choosing the Inspect option or hitting the F12 key. Copy the snippet and execute it in the console. Each group will be processed to generate Markdown for the list of links. The respective generated Markdown is placed in textarea elements next to the OneTab tab group.

[...document.querySelectorAll('.tabGroup')].forEach(it => {

(it.style && (it.style.position = 'relative'));
var groupTitle = it.querySelector('.tabGroupTitleText').innerText.trim();
var contents = '## ' + groupTitle + '\n\n';

+++ title = "Load Tests as Code" outputs = ["Reveal"] [reveal_hugo] custom_theme = "reveal-hugo/themes/robot-lung.css" margin = 0.2 highlight_theme = "color-brewer" transition = "slide" transition_speed = "fast" +++

@pn11
pn11 / tab_json2md.py
Last active September 29, 2022 15:09
Convert Chrome tab list extracted from Android into a Markdown and a OneTab-importable format.
# In advance, tabs.json have to be extracted via ADB by following way. (See https://android.stackexchange.com/a/199496/340082 for detail.)
# adb forward tcp:9222 localabstract:chrome_devtools_remote
# wget -O tabs.json http://localhost:9222/json/list
import json
with open('tabs.json') as f:
tabs = json.load(f)
with open('tabs.md', 'w') as f:
f.write(f"# {len(tabs)} tabs in your Android Chrome\n\n")
@alirezamika
alirezamika / autoscraper-examples.md
Last active July 15, 2025 10:08
AutoScraper Examples

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)

Electron is tricky to get set up on Windows Subsystem for Linux, but it can work!

Four things needed overall:

  1. you need WSL2, not WSL1
  2. you need node, of course, and that part isn't so bad
  3. you need to apt install several dependencies
  4. you need an X Server so it can display the electron GUI over in Windows-land

Setup instructions, in order:

@fernandodenitto
fernandodenitto / mBoxSendersExctractor.py
Created March 16, 2020 20:47
mBoxSendersExtractor
import mailbox
#WARNING:Check the right path for your .mbox file, in Mac OS Environment the .mbox is a directory so you can navigate it
# the .box files could be very heavy also!
mbox_path='INBOX.mbox/mbox'
file_to_store_fields_path='mail_addresses_from_mbox.txt'
mbox = mailbox.mbox(mbox_path)
require "sqlite3"
require 'set'
require 'byebug'
# Will be rebuilt at any time. Nice and incremental.
db = SQLite3::Database.new "index.db"
# Keep prefix indexes for "mos*" searches.
#
# TODO: It doesn't seem like SQLITE FTS5 supports synonyms well. That's ok, but
# we're going to want that. We can download this database from Princeton, write