Skip to content

Instantly share code, notes, and snippets.

@timelf123
timelf123 / gist:c2651fdb22edb99845668243c08f1239
Created September 25, 2024 12:50
summarize amazon review colors.js
// Global object to track color frequency across all pages
const allColorsFrequency = {};
// Function to extract color information from a review element
function extractColorFromReview(review) {
// Attempt to find the color link within the review (if available)
const colorElement = review.querySelector('a[data-hook="format-strip"]');
if (colorElement) {
// Extract the text (e.g., "Color: Multicam - Black")
@timelf123
timelf123 / gource-multiple-repositories.sh
Created November 7, 2023 14:56 — forked from cgoldberg/gource-multiple-repositories.sh
Generates gource video of multiple source code repositories.
#!/usr/bin/env bash
# Generates gource video out of multiple repositories.
# First, get a local branch/clone of each repository.
# Then, pass the repositories as command line arguments.
#
# Example:
# $ gource-multiple-repositories.sh /path/to/repo1 /path/to/repo2
@timelf123
timelf123 / gource-commands.txt
Created November 7, 2023 14:43 — forked from rafi/gource-commands.txt
Gource command
################################
gource commands
################################
# basic command for big and long projects
gource --max-user-speed 500 --seconds-per-day 0.05 --file-idle-time 10 -e 0.005 -f --max-files 300 --hide-files
# some easy to understand commands
# for output file
--output-ppm-stream ~/ppm/ppm-kohana
@timelf123
timelf123 / capture-graphql.py
Created March 31, 2023 22:39
mitmdump -s capture-graphql.py
# mitmdump -s capture-graphql.py
import json
import re
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
if flow.request.url.endswith('/graphql'):
payload = json.loads(flow.request.content.decode('utf-8'))
filename = re.sub(r'[^a-zA-Z0-9]', '_', payload['operationName']) + '.graphql.txt'
@timelf123
timelf123 / powershell_dynamic_ip_notifier.ps1
Created December 12, 2022 15:54
Cross platform powershell to notify you when your dynamic IP changes
<#
Before you execute this, run this in powershell to get notification script installed:
Install-Module -Name PoshNotify
#>
$LOG="$HOME/.myip"
# Update the log file and show a notification with the current IP
function Update() {
@timelf123
timelf123 / user.boxstarter.ps1
Last active June 15, 2024 10:15 — forked from asford/tyger.boxstarter.ps1
Winget Boxstarter Developer
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
# OR
# Install-BoxstarterPackage -PackageName <URL-TO-RAW-GIST> -DisableReboots
#
@timelf123
timelf123 / pvenode-rename
Created June 9, 2020 22:03 — forked from pierew/pvenode-rename
Changing a Proxmox VE Nodes name when it is not in a cluster
OLDNAME=$(hostname)
hostnamectl set-hostname ${1}
mkdir -p /etc/pve/nodes/${1}
cp -a /etc/pve/nodes/${OLDNAME} /etc/pve/nodes/${1}
echo 'A reboot is required, Exit with CTRL-C'
read
@timelf123
timelf123 / gcp-gpu-vm-hashcat.md
Created December 9, 2019 23:19 — forked from koenrh/gcp-gpu-vm-hashcat.md
Running Hashcat on Google Cloud's new GPU-based VMs

Running Hashcat on Google Cloud's GPU-based VMs

In February 2017, Google announced the availability GPU-based VMs. I spun up a few of these instances, and ran some benchmarks. Along the way, I wrote down the steps taken to provision these VM instances, and install relevant drivers.

Update April 2019: Updated instructions to use instances with the Tesla T4 GPUs.

// APIStoreProps are properties that need to be
// ignored when running APIStore.makeStore()
const APIStoreProps = ['use', 'classes', 'constructor', 'init', 'state']
// getMethods returns methods defined
// in a given class' prototype, except init and constructor
const getMethods = (cls) => {
return Object.getOwnPropertyNames(cls.prototype)
.reduce((obj, prop) => {
@timelf123
timelf123 / cloudflare-workers-apilityio.js
Created October 17, 2019 01:58 — forked from diegoparrilla/cloudflare-workers-apilityio.js
Using Cloudflare Workers and https://Apility.io API add to the request headers information of the blacklists of abusers that contains the IP address of the client.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckOrigin(event.request))
})
async function fetchAndCheckOrigin(req) {
try {
startTime = new Date();
const body = await req.body;
const ip = req.headers.get('cf-connecting-ip');
const es = req.headers.get('cf-ipcountry');