Skip to content

Instantly share code, notes, and snippets.

@vdepagter
vdepagter / Configure-ChromeFlags.ps1
Last active March 10, 2023 14:52
Configure chrome://flags (enabled_labs_experiments) through users' Local State file
# Source: https://gist.github.com/vdepagter/c3a66526467c381bc0b416ca879183c8
# Requires all Chrome processes to be stopped (check persistent task bar).
# Modify $SetProperties as desired. These flags will be added or modified. Existing flags are preserved.
If (Test-Path "I:\Chrome") {
Start-Transcript "I:\Chrome\Set-ChromePrefs.log"
[array]$SetProperties = 'enable-native-notifications@2','enable-system-notifications@2'
try {
If (Test-Path "HKCU:\Software\Policies\Google\Chrome") { $LocalStateFile = (Get-ItemProperty "HKCU:\Software\Policies\Google\Chrome").UserDataDir + '\Local State' }
If (-not $LocalStateFile) { $LocalStateFile = "$($env:localappdata)\Google\Chrome\User Data\Local State" }
#notepad $LocalStateFile
@nahun
nahun / README.md
Last active November 5, 2024 09:42
NetBox with AzureAD OAuth

NetBox with AzureAD SSO using OAuth

This is an example setup with NetBox using AzureAD for authentication. It uses the Python Social Auth library.

Most of this was taken from this gist: https://gist.github.com/leoluk/16d91ec22d833945c7ac7ed2b3b05a27

This is written to support NetBox v2.10 to v3.0. I'll try to note differences for 2.9 or earlier.

NOTE: NetBox v3.1 added basic support for using social_auth so most of this is no longer required and can be placed in the configuration.py file.

AzureAD Setup

from django.utils.text import slugify
from dcim.constants import *
from dcim.models import Device, DeviceRole, DeviceType, Site, Interface
from circuits.models import Circuit
from ipam.models import VLAN, VLANGroup, Role, Prefix, IPAddress
from extras.models import Tag
from extras.scripts import *
class NewELineService(Script):
@edxi
edxi / Compare-Hashtable.ps1
Last active November 30, 2021 09:20
Compare-Hashtable
function Compare-Hashtable {
<#
.SYNOPSIS
Compare two Hashtable and returns an array of differences.
.DESCRIPTION
The Compare-Hashtable function computes differences between two Hashtables. Results are returned as
an array of objects with the properties: "key" (the name of the key that caused a difference),
"side" (one of "<=", "!=" or "=>"), "lvalue" an "rvalue" (resp. the left and right value
associated with the key).
@inntran
inntran / cisco-trustpool-import-bundle.md
Last active February 8, 2025 19:33
Trusted ROOT certificates for HTTPS client on Cisco IOS 15 M&T

Background

If you ever need to access HTTPS site from a Cisco router running IOS, whether it's the copy command or TR-069 client or DDNS HTTP client, the request won't go through, because the SSL/TLS certificate (chain) provided by the server cannot be validated.

Install the Cisco provided trusted root bundle

Before you import CA bundle

Setup trustpool policy

crypto pki trustpool policy
 cabundle url http://www.cisco.com/security/pki/trs/ios.p7b
 chain-validation
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@dbroeglin
dbroeglin / Compare-Hashtable.Tests.ps1
Last active December 16, 2024 09:37
A simple Compare-Hashtable function for powershell
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Compare-Hashtable" {
Context "When both are empty" {
$Left, $Right = @{}, @{}
It "should return nothing" {
Compare-Hashtable $Left $Right | Should BeNullOrEmpty
@raulmoyareyes
raulmoyareyes / networkCommand.md
Last active March 26, 2025 18:05
Linux command to check Internet connection speed.

# View public IP

  • curl -s checkip.dyndns.org | sed 's#.Address: (.)</b.*#\1#'
  • wget -qO - icanhazip.com
  • curl ifconfig.me
  • curl ident.me
  • dig +short myip.opendns.com @resolver1.opendns.com
  • lynx -dump ifconfig.me | grep 'IP Address'
  • curl ipecho.net/plain
  • curl bot.whatismyipaddress.com
  • curl ipinfo.io
@9to5IT
9to5IT / Script_Template.ps1
Last active May 2, 2025 14:16
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 19, 2025 17:31 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.