Skip to content

Instantly share code, notes, and snippets.

View valorad's full-sized avatar
🤕
è

Valorad the Oneiroseeker valorad

🤕
è
  • SCET
  • Dhirim
  • 07:46 (UTC -04:00)
View GitHub Profile
@valorad
valorad / InstallingXRDP.md
Created June 5, 2022 13:18
Installing xrdp

Ubuntu:

sudo apt install xrdp 
sudo adduser xrdp ssl-cert 
sudo systemctl restart xrdp

Fedora:

@valorad
valorad / nginx_modsite
Created March 31, 2017 04:49
Nginx enable/disable site config by Ghassen Telmoudi from serverfault.com
#!/bin/bash
##
# File:
# nginx_modsite
# Description:
# Provides a basic script to automate enabling and disabling websites found
# in the default configuration directories:
# /etc/nginx/sites-available and /etc/nginx/sites-enabled
# For easy access to this script, copy it into the directory:
@valorad
valorad / Export-UntrustedGuardian.ps1
Last active February 28, 2024 03:15
Hyper-V TPM Migration (To solve error: "The key protector could not be unwrapped" that causes VM startup failure)
$GuardianName = 'UntrustedGuardian'
$CertificatePassword = Read-Host -Prompt 'Please enter a password to secure the certificate files' -AsSecureString
$guardian = Get-HgsGuardian -Name $GuardianName
if (-not $guardian)
{
throw "Guardian '$GuardianName' could not be found on the local system."
}
@valorad
valorad / getRandomNumberBetween.apex
Last active February 2, 2024 19:45
Salesforce Apex get a random Integer number ∈ [minValue, maxValue)
/**
* get a random Integer number ∈ [minValue, maxValue)
*/
public Integer getRandomNumberBetween(Integer minValue, Integer maxValue) {
if (minValue > maxValue) {
// swap position
Integer tmp = minValue;
minValue = maxValue;
maxValue = tmp;
@valorad
valorad / windows11-post-installs.md
Last active November 6, 2023 17:59
Post Installation steps for Windows 11

Activation

Activate with money or with your favorite tools.

Create folders

  • _staging (or M:) downloadCenter
  • (Shortcut) %HOME%\Downloads\localDownloadCenter

Personalization

  • Change host name (with powershell Rename-Computer)
@valorad
valorad / proxmox-ct-mount.md
Last active October 24, 2023 16:52
Proxmox Container Mounting

Need to login as root

Host: /etc/pve/lxc/XXX.conf

arch: amd64
cores: 1
features: nesting=1
hostname: MY_HOST_NAME
memory: 512
@valorad
valorad / openssh-setup.md
Last active August 27, 2023 18:06
SSH Private key set-ups on Linux and on Windows

Linux

ssh-keygen -t ed25519

cat ~/.ssh/id_ed25519.pub > ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 400 ~/.ssh/authorized_keys
chmod 400 ~/.ssh/id_ed25519
@valorad
valorad / fcos-post-installs.md
Last active August 19, 2023 21:30
Fedora Core OS post installation steps

Podman sucks at this stage. Please enable docker

  1. Enable docker
systemctl enable docker
  1. Add yourself to docker group. Log out and log back in to take effect
@valorad
valorad / deepMerge.ts
Created August 18, 2020 17:46
Deep Merge TypeScript
const isObject = (obj: any) => obj && typeof obj === 'object';
const deepMergeInner = (target: any, source: any) => {
Object.keys(source).forEach((key: string) => {
const targetValue = target[key];
const sourceValue = source[key];
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
target[key] = targetValue.concat(sourceValue);
} else if (isObject(targetValue) && isObject(sourceValue)) {
@valorad
valorad / woniuFRAutoExpandMore.js
Last active January 17, 2023 14:06
Woniu FR Auto load more. No need to scroll down and click that freaking button each time want to load more.
// update 20230117
// works on https://www.woniufr.vip/p/t_pc/course_pc_detail/video/xxx
// Important: Switch to "目录" tab before executing the following code.
const clickElementAndWait = (element, timeMS = 2000) => {
return new Promise((resolve, reject) => {
element.dispatchEvent(new MouseEvent('click'));
setTimeout(() => {
resolve();
}, timeMS);