Skip to content

Instantly share code, notes, and snippets.

View AdrianKoshka's full-sized avatar
🦉
Focusing

Adrian Lucrèce Céleste AdrianKoshka

🦉
Focusing
View GitHub Profile
@sneakers-the-rat
sneakers-the-rat / clean_pdf.sh
Last active February 14, 2024 16:52
Strip PDF Metadata
# --------------------------------------------------------------------
# Recursively find pdfs from the directory given as the first argument,
# otherwise search the current directory.
# Use exiftool and qpdf (both must be installed and locatable on $PATH)
# to strip all top-level metadata from PDFs.
#
# Note - This only removes file-level metadata, not any metadata
# in embedded images, etc.
#
# Code is provided as-is, I take no responsibility for its use,
@mainframed
mainframed / markdown_to_ispf.py
Last active June 3, 2022 16:10
Python script to create an ISPF panel from markdown
#!/usr/bin/env python
import os
import re
def make_header(name):
return ''')ATTR DEFAULT(%+_)
% type(text) intens(high)
~ type(text) intens(high) caps(off) just(asis ) color(red)
+ type(text) color(turq) caps(off)
` type(text) intens(high) caps(off) just(asis) color(yellow)
@dfinke
dfinke / Get-YouTubeLinkAndThumbnail.ps1
Last active August 27, 2018 07:57
Generate the YouTube html for an image with a link to the video
function Get-YouTubeLinkAndThumbnail {
param(
[Parameter(Mandatory)]
$YouTubeVideoID,
$Width=240,
$Height=180,
$ImageAltText='IMAGE ALT TEXT HERE',
[Switch]$DontCopyToClipboard
)

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg

Font "package manager"

I've been thinking about creating a font management service similar to traditional software package managers (e.g. Debian Aptitude, NPM, etc.)

The basic idea is this:

  1. There's a main repository of fonts that are free (as in free to distribute) that the working group hosts
  2. There's a small program that serves as the "manager", to be used or installed on client systems
  3. The "manager" can be configured to operate with multiple repositories
@mackwage
mackwage / windows_hardening.cmd
Last active April 23, 2024 15:13
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
:
@Rurik
Rurik / parse_procmon_filters.py
Last active December 5, 2021 16:55
Quick tool to find and extract filters from Procmon configuration files
# Procmon Rule Parser v0.02
# Brian Baskin - @bbaskin
# Reads default rules from an exported Procmon Configuration (.PMC) or Procmon Filter (.PMF) file
# Example output:
"""
12:09:59-bbaskin@~/Development/Noriben$ python parse_procmon_filters.py -f ProcmonConfiguration.pmc
[Exclude] Process Name is Procmon64.exe
[Exclude] Operation is QueryStandardInformationFile
[Exclude] Operation is RegOpenKey
[Exclude] Operation is NotifyChangeDirectory
#!/bin/bash
# Nmap can crash when scanning large ranges
# To use this script, start your scan with whatever
# nmap options you want making sure you use -oA <filename>
# or -oG <filename> (you need the gnmap file) then cancel
# the scan. replace <filename> below and run this script.
# It will also record when it failed to a file called failed.txt
until nmap --resume <filename>.gnmap
@mattifestation
mattifestation / FileReadPrimitive.ps1
Last active June 12, 2023 16:33
A WMI file content read primitive - ROOT/Microsoft/Windows/Powershellv3/PS_ModuleFile
$CimSession = New-CimSession -ComputerName 10.0.0.2
$FilePath = 'C:\Windows\System32\notepad.exe'
# PS_ModuleFile only implements GetInstance (versus EnumerateInstance) so this trick below will force a "Get" operation versus the default "Enumerate" operation.
$PSModuleFileClass = Get-CimClass -Namespace ROOT/Microsoft/Windows/Powershellv3 -ClassName PS_ModuleFile -CimSession $CimSession
$InMemoryModuleFileInstance = New-CimInstance -CimClass $PSModuleFileClass -Property @{ InstanceID= $FilePath } -ClientOnly
$FileContents = Get-CimInstance -InputObject $InMemoryModuleFileInstance -CimSession $CimSession
$FileLengthBytes = $FileContents.FileData[0..3]
[Array]::Reverse($FileLengthBytes)
#!ipxe
kernel http://example.com/linux initrd=initrd.gz auto url=http://example.com/preseed.cfg
initrd http://example.com/initrd.gz
boot