Skip to content

Instantly share code, notes, and snippets.

View supermarsx's full-sized avatar
👾

supermarsx

👾
  • Portugal
  • 09:11 (UTC +01:00)
View GitHub Profile
@supermarsx
supermarsx / requestPromise.js
Created September 19, 2020 12:34
Do a promisified HTTP/HTTPS request
// jshint esversion:8
// jshint node:true
'use strict';
const https = require('https');
const http = require('http');
/*
request
@supermarsx
supermarsx / loginFacebook.js
Created December 8, 2020 01:55
Login to Facebook using email and password with Puppeteer
/*
loginFacebook
Login to Facebook using email and password
.parameters
page (object) - Page object
credentials (object) - Credentials object with email and password properties
.returns
success (boolean) - Login to facebook success
*/
async function loginFacebook(page, credentials = {}) {
@supermarsx
supermarsx / getFacebookPageName.js
Created December 8, 2020 02:00
Get Facebook page name with Puppeteer
/*
getPageName
Get page name
.parameters
page (object) - Page object
options (object) - Options object
.returns
pageName (string) - Page name
*/
async function getPageName(page, options = {}) {
@supermarsx
supermarsx / EnableAdobeAcrobatReaderUpdates.ps1
Last active June 20, 2022 10:31
Enable Adobe Acrobat/Reader updates (Services, Task Scheduler, Registry), adobe update patch
# Enable update service (Services)
Set-Service AdobeARMservice -StartupType Automatic
Start-Service AdobeARMservice
# Enable Adobe Genuine Monitor Service
Set-Service AGMService -StartupType Automatic
Start-Service AGMService
# Enable Adobe Genuine Software Integrity Service
Set-Service AGSService -StartupType Automatic
@supermarsx
supermarsx / DisableAdobeAcrobatReaderUpdates.ps1
Last active November 15, 2022 02:29
Disable Adobe Acrobat/Reader updater (Services, Task Scheduler, Registry), adobe update patch
# Disable update service (Services)
Set-Service AdobeARMservice -StartupType Disabled
Stop-Service AdobeARMservice -Force -NoWait
# Disable Adobe Genuine Monitor Service
Set-Service AGMService -StartupType Disabled
Stop-Service AGMService -Force -NoWait
# Disable Adobe Genuine Software Integrity Service
Set-Service AGSService -StartupType Disabled
@supermarsx
supermarsx / isObjectEmpty.js
Last active April 14, 2021 11:54
Check if an object is empty in plain javascript
/*
isObjectEmpty
Check if a given object is empty
.parameters
object (object) - Object to check whether its empty or not
.returns
true or false (boolean) - True if object is empty, false otherwise
*/
function isObjectEmpty(object) {
return (Object.keys(object).length === 0 && object.constructor) === Object ? true : false;
@supermarsx
supermarsx / isObject.js
Created April 14, 2021 11:55
Check if a given variable is an object with plain javascript
/*
isObject
Check if given variable is an object
.parameters
variable (any) - Variable to test for object type
.returns
true or false (boolean) - True if is object, false otherwise
*/
function isObject(variable) {
return (typeof variable === 'object' && variable !== null) ? true : false;
@supermarsx
supermarsx / truncateString.js
Last active April 30, 2021 13:17
Truncate a given string with plain javascript
/*
truncateString
Truncate a given string
.parameters
string (string) - String to truncate
charNum (integer) - Number of chars to truncate for
useWordBoundary (boolean) - Use word boundaries, default: false
.returns
truncatedString (string) - Truncated string, original string if is below char count
*/
@supermarsx
supermarsx / Get-LocalMailboxCopyStatus.ps1
Created April 14, 2021 22:10
Get Exchange content search index status
Get-MailboxDatabaseCopyStatus -Server $env:ComputerName | Format-Table Name,Status,ContentIndex* -Auto
@supermarsx
supermarsx / FixRealtekPoppingSound.ps1
Last active February 13, 2024 05:24
Fix popping sound on some Realtek sound cards, realtek audio crackling patch
# Enable Realtek driver power management, this is the default value
REG ADD "HKCU\Software\Realtek\RAVCpl64\PowerMgnt" /v "Enabled" /t REG_DWORD /d 1 /f
# Disable Realtek driver power management, sometimes fixes realtek popping sound
REG ADD "HKCU\Software\Realtek\RAVCpl64\PowerMgnt" /v "Enabled" /t REG_DWORD /d 0 /f
# Replace XXXX with the corresponding key that has "Realtek" in the "DriverDesc", find using regedit
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\XXXX\PowerSettings" /v "IdlePowerState" /t REG_BINARY /d "ffffffff" /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\XXXX\PowerSettings" /v "PerformanceIdleTime" /t REG_BINARY /d "ffffffff" /f
# Example if class is in 0000