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 / 98custom-upgrades
Last active September 20, 2021 02:19
Kali Repo Setup
Unattended-Upgrade::Origins-Pattern {
#"a=ARCHIVE/SUITE,n=CODENAME,o=ORIGIN,l=LABEL";
#"origin=,suite=";
#"site=,component=";
"origin=Kali,suite=kali-rolling";
"origin=Debian,label=Debian";
"origin=Debian,label=Debian-Security";
"origin=Debian Backports,label=Debian Backports";
};
@demosjarco
demosjarco / fontend-secure-genid.js
Created July 30, 2021 20:18
Generate random id of any length securely in the front end using browser window.crypto
function genId(size = 1) {
let array = new Uint32Array(size);
window.crypto.getRandomValues(array);
let sessionString = '';
array.forEach((e) => {
sessionString += e.toString(36);
});
return sessionString;
}
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 `
@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
/home/steam/.steam/steam/steamapps/common/SatisfactoryDedicatedServer/FactoryGame/Saved/Logs/*.log {
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 0644 steam steam
}
@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
@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 / 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 / powershell.pwsh
Created September 23, 2023 15:35
Common commands
pip uninstall -y (pip freeze)
@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