Skip to content

Instantly share code, notes, and snippets.

Avatar
🎲
Ma le spegnene?

Fabio Dragod

🎲
Ma le spegnene?
View GitHub Profile
@Dragod
Dragod / addClass.js
Created Jul 14, 2022
Vanilla js add class
View addClass.js
let addClass = (el = [], className= 'disnone') => {el.forEach(el => { return document.querySelector(el).classList.add(className) })}
addClass(['.login .homepageLogo','.cs-login-Instruct', '.sd-login', '.loginDisclaimer', '.login'])
@Dragod
Dragod / revert-branch-to-old-commit.sh
Last active May 6, 2022
Reverting The Working Copy to an Older Commit
View revert-branch-to-old-commit.sh
# https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit#4114122
# Reverting The Working Copy to an Older Commit
# To revert to a commit that's older than the most recent commit:
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
@Dragod
Dragod / searx-boot.sh
Created Apr 24, 2022
Run searx with a cronjob using a sh script
View searx-boot.sh
#!/bin/bash
sudo -H -u searx -i sh -c "cd /usr/local/searx/searx-src; python searx/webapp.py"
@Dragod
Dragod / interfaces
Last active May 6, 2022
Proxmox network config
View interfaces
#etc/network/interfaces
auto lo
iface lo inet loopback
auto enp4s0
iface enp4s0 inet manual
auto vmbr0
@Dragod
Dragod / Fix.json
Created Nov 8, 2021
Solve package-lock.json problems
View Fix.json
{
"scripts": {
"clean": "rm -Rf node_modules/ && rm -f ./package-lock.json && npm cache clean -f",
"clean_windows": "IF EXIST node_modules rd /s /q node_modules && IF EXIST package-lock.json DEL package-lock.json && npm cache clean -f",
"rebuild": "npm run clean && npm i",
"rebuild_windows": "npm run clean_windows && npm i"
}
}
View design-machine-installer.ps1
# Description: Screendragon Design install for new machine or new VM boot
# Author: Paniconi Fabio
# Last update: 29/10/2021
# Install Chocolatey, required to run the rest of the scripts
Write-Output "`r"
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
@Dragod
Dragod / DevMachineSetup.ps1
Last active Oct 29, 2021
DevMachineSetup
View DevMachineSetup.ps1
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Write-host "`r"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
@Dragod
Dragod / exexSync_error_catch.md
Last active Oct 5, 2021
Catch exexSync errors
View exexSync_error_catch.md

If you want to get net wlan show profiles output no matter if it fails or not, you can use either asynchronous version of exec. The callback will have stdout set.

Or you can catch exception and get stdout from there. Something like:

let nestsh_output;
try {
  netsh_output = execSync('netsh wlan show profiles');
} catch (ex) {
 netsh_output = ex.stdout;
@Dragod
Dragod / winget-on-bash.md
Created Sep 29, 2021
Make winget work on bash
View winget-on-bash.md

Enable windows subsystem in powershell

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Ebable virtual machine feature in powershell

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
@Dragod
Dragod / add-to-gitignore.md
Last active Sep 22, 2021
Remove exsisting file/repo and add it to .gitignore
View add-to-gitignore.md

Remove a file from the repo and add it to .gitignore

git rm --cached resources/sprite/dist/sprite.svg

Remove a all file from a folder in a repo and add it to .gitignore

git rm -r --cached resources/sprite/svgo