Skip to content

Instantly share code, notes, and snippets.

View demosjarco's full-sized avatar
😈
Bug Developer

Victor demosjarco

😈
Bug Developer
View GitHub Profile
@demosjarco
demosjarco / fix windows.ps1
Last active July 13, 2025 23:09
Run `sfc` and `DISM` (both windows update and ISO)
# https://www.microsoft.com/en-us/software-download/windows11
# Select > Download Windows 11 Disk Image (ISO) for x64 devices
# Self-elevate if not running as administrator
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Script is not running as administrator. Attempting to relaunch with elevated privileges..."
Start-Process -FilePath "powershell.exe" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -File `"$PSCommandPath`"" -Verb RunAs
exit
}
@demosjarco
demosjarco / settings.json
Created July 8, 2024 04:05
Windows Terminal Config
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
@demosjarco
demosjarco / command.pwsh
Last active July 21, 2025 07:48 — forked from laurentpellegrino/microsoft-azure-datacenters.json
Microsoft Azure Datacenters (including coordinates)
Get-AzLocation -ExtendedLocation $true | ConvertTo-Json -Depth 100 > microsoft-azure-datacenters.json
@demosjarco
demosjarco / powershell.pwsh
Created September 23, 2023 15:35
Common commands
pip uninstall -y (pip freeze)
@demosjarco
demosjarco / types.d.ts
Created September 15, 2023 18:56
Random helper types
// Returns the equivalent of a type after running it through JSON.parse(JSON.stringify(object))
type MethodKeys<T> = {
[P in keyof T]: T[P] extends (...args: any[]) => any ? P : never;
}[keyof T];
export type JsonParsed<T> = Omit<T, MethodKeys<T>>;
@demosjarco
demosjarco / emailGenerate.ts
Created September 12, 2023 23:51
Generate DKIM record and private key using built in libraries only
import { generateKeyPair } from 'node:crypto';
export class EmailDkimGenerator {
public generate(selector?: string | string[]) {
return new Promise<{ dkimDnsRecord: { name: string; content: string }; privateKey: string }>((resolve, reject) => {
generateKeyPair(
'rsa',
{
modulusLength: 2048,
publicKeyEncoding: {
@demosjarco
demosjarco / Dockerfile
Created August 1, 2023 17:17
Description of docker images
# This is the standard Docker image for the latest Long-Term Support (LTS) version of Node.js. It's built on top of a Debian-based image and includes a full installation of Node.js and npm. It's quite large in size, but it has wide compatibility and includes a number of common system libraries and dependencies
FROM node:lts
# The "slim" image is a smaller version of the standard image. It's also based on Debian, but it excludes a lot of the additional software included in the standard image. This can make it more appropriate for production deployments where you want to minimize the size of your Docker images, but you may need to manually install additional system dependencies that your Node.js application requires
FROM node:lts-slim
# The "alpine" image is even smaller than the "slim" image. It's built on top of the Alpine Linux distribution, which is designed to be very lightweight. The reduced size comes at the cost of using a different libc (musl instead of glibc) and having fewer preinstalled system libra
/home/steam/.steam/steam/steamapps/common/SatisfactoryDedicatedServer/FactoryGame/Saved/Logs/*.log {
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 0644 steam steam
}
@demosjarco
demosjarco / secure-service.service
Last active April 3, 2022 22:24
Secure systemd service settings that should be default but are not enabled by default on latest debian/ubuntu
[Unit]
Description=Secure example
After=network-online.target
BindsTo=network-online.target
[Service]
# Use `systemd-analyze security <service name>` to test
# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html for options
DynamicUser=true
ProtectHome=true
Set-Content -Path $env:USERPROFILE\Desktop\ad-accounts.txt -Value "Generated on $(Get-Date)"
Add-Content -Path $env:USERPROFILE\Desktop\ad-accounts.txt -Value ""
$response = Invoke-RestMethod -Uri "https://randomuser.me/api?inc=name,picture&nat=GB,US&results=$(Read-Host "Number of users to generate")&noinfo"
foreach ($generatedUser in $response.results) {
Add-Content -Path $env:USERPROFILE\Desktop\ad-accounts.txt -Value ("Name: " + $generatedUser.name.first + " " + $generatedUser.name.last)
Add-Content -Path $env:USERPROFILE\Desktop\ad-accounts.txt -Value ("Username: " + $generatedUser.name.first + "." + $generatedUser.name.last).ToLower()
$genPlainPassword = [System.Web.Security.Membership]::GeneratePassword(25, 1)
Add-Content -Path $env:USERPROFILE\Desktop\ad-accounts.txt -Value ("Password: " + $genPlainPassword)
$genPassword = ConvertTo-SecureString $genPlainPassword -AsPlainText -Force
$newUser = New-ADUser -PassThru -AccountPassword $genPassword `