Skip to content

Instantly share code, notes, and snippets.

- Linkedin: https://www.linkedin.com/in/charles-karpati/
- Github: https://www.github.com/karpatic
- Email: charleskarpati@gmail.com
- Website: https://charleskarpati.com
- Phone: +1 301 300 4728
- Spouse of or is Military Veteran: False
- Disabilities: None
- Residency: Washington D.C.
- Citizenships: United States of America and Hungary (European Union)
@karpatic
karpatic / Get Conversation
Created September 9, 2024 02:21
Facebook Conversation Scraper
let talker = 'left';
let messageData = [];
// Helper function to add a delay (1 second)
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
// Select the third grid element (index 2 since it's 0-based)
let grid = document.querySelectorAll('div[role="grid"]')[2];
// Function to check if a message already exists in the messageData array
async function getLatestGistUpdate(gistId, fileName) {
const url = `https://api.github.com/gists/${gistId}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch gist: ${response.statusText}`);
}
const gistData = await response.json();
@karpatic
karpatic / Makefile Pip Deploy
Last active September 3, 2024 16:37
Python commands to build and upload a package using twine.
pip:
rm -rf build/
rm -rf dist/
python setup.py sdist bdist_wheel
twine upload dist/* --verbose
@karpatic
karpatic / Termux Instructions.txt
Last active September 3, 2024 16:34
Instructions for setting up a Termux script to send a file to a specific domain with a single button on your Android homescreen using Termux:Widget.
to set up a script in Termux that can be run with a single button on your Android homescreen to send a file to a specific domain.
- Install Termux from F-Droid (or Google Play if available).
- Install Termux:Widget to create the button on the homescreen.
Complete Instructions: [here](https://github.com/termux/termux-widget)
When you install the Termux:Widget, it expects scripts (bash scripts with a .sh extension) to be located in a specific directory
(~/.shortcuts/). Any script you place in that directory will be automatically recognized by Termux:Widget and
will be available for you to place as a widget on your Android homescreen.
@karpatic
karpatic / Python library makefile commands
Last active September 3, 2024 16:31
Workflow including making, updating, bumping versions, building, uploading to PyPI, and cleaning
# Below: Depricated Python implementation used before switching to js
maker:
make nb2py && make bump && make build && make pypi && make clean && make upd
upd:
pip uninstall cvminigames && pip install cvminigames && make sitemap
nb2py:
nb2py ./ipynb/_000_core.ipynb ./cvminigames/outp.py
<div style='display:flex; justify-content: flex-end;'>
<button style='background:red;color:white' name='remove'>Delete</button>
</div>
setInterval(() => {
document.querySelectorAll('*').forEach(element => {
if (element.textContent.trim() === 'Continue generating') {
element.click();
}
});
}, 1000);
@karpatic
karpatic / bookmark.js
Last active April 16, 2024 20:55
Bookmark urls can be javascript:()(); This one imports and runs bookmark.js
console.log('success');
async function getCopiedText() {
try {
const text = await navigator.clipboard.readText();
console.log('Copied text:', text);
} catch (err) {
console.error('Failed to read clipboard contents:', err);
}
}
getCopiedText();
Get-ChildItem "C:\MyFolder" -File -Recurse | ForEach-Object { $_.CreationTime = Get-Date "03/15/2024 12:00:00" }