Skip to content

Instantly share code, notes, and snippets.

View Dragod's full-sized avatar
🎲
Ma le spegnene?

Fabio Dragod

🎲
Ma le spegnene?
View GitHub Profile
@Dragod
Dragod / jenkins-api.md
Created October 27, 2022 17:28 — forked from justlaputa/jenkins-api.md
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@Dragod
Dragod / install-psu.sh
Created October 20, 2022 08:21 — forked from thereverand/install-psu.sh
Install PowerShell Universal as a service on Linux
# ----
# This script will install PowerShell Universal on Linux as a service
# This has been tested on Ubuntu 20.04 (ARM64) on a Raspberry Pi 4
# ----
# Dependencies:
# wget
# unzip
#
# Make sure they are installed
# ----
@Dragod
Dragod / addClass.js
Created July 14, 2022 08:00
Vanilla js add class
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 11:03
Reverting The Working Copy to an Older Commit
# 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 April 24, 2022 12:31
Run searx with a cronjob using a sh script
#!/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 11:05
Proxmox network config
#etc/network/interfaces
auto lo
iface lo inet loopback
auto enp4s0
iface enp4s0 inet manual
auto vmbr0
@Dragod
Dragod / Fix.json
Created November 8, 2021 15:06
Solve package-lock.json problems
{
"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"
}
}
@Dragod
Dragod / design-machine-installer.ps1
Created October 29, 2021 18:09
Design-machine-installer
# 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 October 29, 2021 18:02
DevMachineSetup
#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 October 5, 2021 15:40
Catch exexSync errors

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;