Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# Script to print out the current power cycles and capacity of Macbooks
# which provide this info.
# -------
CYCLE_COUNT=`system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'`
MAX_CAPACYTY=`system_profiler SPPowerDataType | grep "Maximum Capacity" | awk '{print $3}'`
echo "Cycle Count: $CYCLE_COUNT"
@fahadysf
fahadysf / Information.md
Created January 9, 2024 13:09
Kubernetes - Cloud Native Technologies Info
@fahadysf
fahadysf / user-creator.ps1
Last active December 7, 2023 08:22
Powershell Local DB User Creator for Panorama Template
### Needed stuff
Add-Type -AssemblyName System.Web
### GLOBAL Settings
$filePath = "C:\code\usernames.txt_CHANGE_ME"
$deviceUrl = "https://panorama_ip_or_fqdn_change_me"
$username = "admin"
$templateName = "template_name_change_me"
$Debug = $true
@fahadysf
fahadysf / panos-backup.ps1
Last active August 31, 2023 09:02
Powershell Script to backup PAN-OS Running Config
# This is a simple powershell script which can be run as a Scheduled Task
# to backup the running config from PAN-OS Firewalls. Tested to work with
# Powershell 5.1 (the default on Windows Server 2012/2016). For more
# up to date versions of powershell you can remove the add-type /
# New-Object TrustAllCertsPolicy section and use -SkipCertificateCheck
# in Invoke-WebRequest
#
# Usage Instructions:
# 1. Update the values of $panosHost and $panosUsername below at the start of the file.
# 2. Run once in the Powershell Promt to generate the API Key file
@fahadysf
fahadysf / panos-config-backup.py
Created August 31, 2023 08:54
Simple Python script to backup the running config from PAN-OS Firewalls or Panorama
import os
import sys
import requests
import argparse
import getpass
import time
# This is a simple Python script which can be run as a Scheduled Task
# to backup the running config from PAN-OS Firewalls or Panorama. Tested to work with
# Python 3.11.5 on Mac OSX and Windows Server 2019.
@fahadysf
fahadysf / xsoar-menu-hide.js
Created April 17, 2023 07:27
UserScript to Hide Navigation Elements in XSOAR
// ==UserScript==
// @name Dashboard Cleaner
// @namespace http://tampermonkey.net/
// @version 0.1b
// @description Removes extra content from XSOAR dashboard
// @author Pandy Brijesh <email@email.com> & Fahad Yousuf <fahadysf@gmail.com>
// @match https://xsoar.fy.loc/*
// @grant none
// ==/UserScript==
(function() {
@fahadysf
fahadysf / keybase.md
Created February 25, 2023 08:46
keybase.md

Keybase proof

I hereby claim:

  • I am fahadysf on github.
  • I am fahadysf (https://keybase.io/fahadysf) on keybase.
  • I have a public key ASCnFJniqfma6cDAgj8ZZ09yKrVeLliB1oxEqiZkT5cazwo

To claim this, I am signing this object:

@fahadysf
fahadysf / quickndirty.ps1
Created January 31, 2023 20:14
There ya go!
$input_file = ".\sample.txt"
$output_file = ".\out.txt"
$text = Get-Content $input_file -Raw
$text | select-string '"[^\"]+"' -AllMatches | Foreach-Object {$_.Matches} | Foreach-Object { $text = $text.replace($_.Groups[0].Value, $_.Groups[0].Value.replace(' ', '_'))}
echo $text
echo $text > $output_file
@fahadysf
fahadysf / README.md
Last active January 26, 2023 20:50
A multiprocess task broker which accepts and provides status reports for tasks using JSON REST API calls.

Multiprocess Task Broker with REST API

This gist shows and example or an asynchronous multiprocess task broker which can take job requests and report on running jobs via a minimal REST API.

Adapted from https://gist.github.com/nitaku/10d0662536f37a087e1b

All of the caveats from the original author still apply.

@fahadysf
fahadysf / update-ddns-namecheap.sh
Created October 14, 2022 07:30
Bash script to update NameCheap DDNS
#!/bin/sh
dnsserver="freedns2.registrar-servers.com"
host="host"
domain_name="your.domain"
ddns_password="YOUR-DDNS-PASSWORD-HERE"
dnsrecord=$host.$domain_name