This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Get-GHRepoList { | |
<# .SYNOPSIS | |
Gets a list of repositories of a GitHub user. #> | |
Param( | |
# User to enumerate | |
[string]$User, | |
# Page size to request | |
[int]$Size = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#/etc/profile.d/xdg_dirs.sh | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
############################################################################### | |
# XDG variables | |
############################################################################### | |
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}" | |
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" | |
export XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Vesion Latest | |
function Invoke-GithubFileRequest { | |
<# .SYNOPSIS | |
Retrieves a file from a Github repository. #> | |
[Alias('gh_curl')] | |
Param( | |
# URL of file to download | |
[Parameter(Mandatory)] | |
[Uri]$URL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from PIL import Image | |
def draw_grid(size_x=1920, size_y=1080, grid_x=3, grid_y=3, border=2, img_x=0, img_y=0): | |
if img_x == 0 or img_y == 0: | |
img_x, img_y = size_x, size_y | |
img = Image.new('RGB', (img_x, img_y), 'white') | |
pixels = img.load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Get-ArpEntry { | |
<# .SYNOPSIS | |
Retrieve system ARP table entries #> | |
Param( | |
# Retrieve all entries (not just learned) | |
[switch]$All | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only run if elevated as administrator | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$admin = [Security.Principal.WindowsBuiltInRole]::Administrator | |
if (!([Security.Principal.WindowsPrincipal]$identity).IsInRole($admin)) { | |
Write-Output 'We are not elevated, launching elevated powershell...' | |
Start-Process -FilePath powershell.exe -Verb RunAs -ArgumentList $MyInvocation.MyCommand.Source | |
Start-Sleep 10 | |
exit 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Edit-VMDKHeader { | |
<# .SYNOPSIS | |
Edit the metadata header of a VMDK file #> | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] | |
Param( | |
# The VMDK file to edit | |
[Parameter(Mandatory)] | |
[string]$VMDKFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ $1 == start && ! -b /dev/mapper/$2 ]] && { | |
[[ -d /sys/module/kvdo ]] || modprobe kvdo | |
target=$(readlink -f $(awk -v dev=$2 '$1~dev && $4~"vdo" {print $6}' /etc/dmsetup.table)) | |
[[ $target =~ /dev/dm- ]] && target=$(find /dev/mapper -type l -lname "*${target##*/}") | |
table=$(awk -v dev=$2 -v target=$target '$1~dev && $4~"vdo" {sub($1FS,""); sub($5,target); print $0}' /etc/dmsetup.table) | |
echo dmsetup create $2 --table "$table" | |
[[ -b /dev/mapper/$2 ]] || exit 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Parses chatterino logs to get stream income from bits and subscriptions | |
get_stream_stats() { | |
local f=${1##*/}; f=${f%.*} | |
printf 'Channel: %s Date: %s\n' "${f%%-*}" "${f#*-}" | |
awk '/[Cc]heer/ { | |
for (i = 1; i <= NF; i++) { | |
if ($i ~ /^[Cc]heer$/) { | |
j = i + 1 | |
token = $i $j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Resolve-DnsRecordAllDCs { | |
<# .SYNOPSIS | |
Resolves a DNS record on all active DCs in a domain #> | |
[Alias('nslookup_all')] | |
Param( | |
# Name to resolve | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[string]$Name, | |
# Type of record | |
[Parameter(ValueFromPipelineByPropertyName)] |