Skip to content

Instantly share code, notes, and snippets.

View Skhmt's full-sized avatar
💭
Working on random things

Skhmt Skhmt

💭
Working on random things
View GitHub Profile
@Skhmt
Skhmt / pw.js
Last active December 20, 2024 19:56
generates a pw
import * as crypto from 'node:crypto';
const charactersUpper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const charactersLower = 'abcdefghijklmnopqrstuvwxyz';
const symbols = '!@#$%&?^*.:,;_-';
const decimalNumbers = '0123456789';
console.log(createRandomString(12, true, 'password', true));
function createRandomString(length = 16, useSymbols = true, prefix = '', useNumbers = true) {
@Skhmt
Skhmt / insomnia.md
Last active April 1, 2024 19:53
Prevent windows from sleeping

Keeping Windows awake without third party programs

Some options based on what permissions your admins allow

Powershell

Paste the following directly in PowerShell or put into PowerShell ISE then highlight the line and click "Run Selection (F8)" to run even if running scripts is disabled via Execution Policy.

$wsh = New-Object -COMObject WScript.Shell; while (1) {$RND = Get-Random -Minimum 30 -Maximum 120; $wsh.SendKeys('+{F15}'); Write-Host "$(Get-Date)"; Start-Sleep -Seconds $RND}

@Skhmt
Skhmt / downloadbookmarklet.js
Last active April 29, 2024 21:17
Bookmarklet to download all images of a given class
javascript: (function () {
document.querySelectorAll('.BRpageimage').forEach(i => {
const url = new URL(i.src);
const filename = url.searchParams.get('file').split('/').pop().replace('.jp2','.jpg');
url.searchParams.set('scale', 1);
dl(url.href, filename);
});
function dl(url, filename) {
function blob2B64(blob, callback) {
@Skhmt
Skhmt / MakePNG.kt
Last active June 8, 2019 08:05
png mixed content
import io.javalin.Javalin
import java.util.zip.CRC32
import java.util.zip.Deflater
/*
main requires:
io.javalin:javalin:2.7.0
org.slf4j:slf4j-simple:1.7.25
test at:
@Skhmt
Skhmt / win10.bat
Last active August 31, 2020 05:37
windows 10 tweaks
:: *** Disable Some Service ***
sc stop DiagTrack
sc stop diagnosticshub.standardcollector.service
sc stop dmwappushservice
sc stop WMPNetworkSvc
sc stop WSearch
sc config DiagTrack start= disabled
sc config diagnosticshub.standardcollector.service start= disabled
sc config dmwappushservice start= disabled