Skip to content

Instantly share code, notes, and snippets.

@Grynn
Grynn / ip_address_list.py
Last active April 12, 2024 13:46
Show all IP addresses with scope in a nice table format
#!/usr/bin/env python
import sys
import os
import json
import pandas as pd
import ipaddress
private_ranges = [
ipaddress.IPv4Network("10.0.0.0/8"),
ipaddress.IPv4Network("172.16.0.0/12"),
@Grynn
Grynn / post_receive
Created March 12, 2023 17:02
post_receive_hook
#!/bin/bash
# Post recv. hook to run deploy.sh from within repo in checkout dir
set -e -u -o nounset
echo "ARGS****************"
read oldrev newrev ref
echo "OLD=$oldrev" "NEW=$newrev" "REF=$ref"
echo "********************"
@Grynn
Grynn / get-ip-addresses.sh
Created February 3, 2023 10:00
Get list of global IP addresses on a computer using ip2 command line
#!/bin/bash
set -eu -o pipefail
ip -j a | jq -r '.[] | .addr_info | map(select(.scope == "global")) | .[] | [ .family, .local ] | @csv'
@Grynn
Grynn / RotHelper.cs
Created December 14, 2011 08:47
COM running object table utility class
/// <summary>
/// COM running object table utility class
/// </summary>
public static class ROTHelper
{
public static IDictionary<string, object> GetActiveObjects(string MonikerFilter)
{
var ret = new Dictionary<string, object>();
IRunningObjectTable pprot;
@Grynn
Grynn / LavaBlast.Linq.Extensions.cs
Created December 14, 2011 07:48 — forked from EtienneT/LavaBlast.Linq.Extensions.cs
Support Lambda functions in place of IEqualityComparer<T>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace System.Linq
{
public class KeyEqualityComparer<T> : IEqualityComparer<T>
{
private readonly Func<T, T, bool> comparer;
<?php
//GetPass for a website
//getpass(sitename.com) returns a XORed version of the sitename + salt
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$homeDir = realpath(getenv("USERPROFILE"));
} else {
$homeDir = realpath("~");
}
$salt = file_get_contents("$homeDir/.salt");
@Grynn
Grynn / pve-ssl-renew.sh
Created September 14, 2020 19:28
Script to renew Proxmox 3.4 SSL Cert (for proxmox management interface)
#!/bin/bash
#Tested with pve-manager/3.4-16/40ccc11c Promox 3.4
servername="your.server.here"
set -e -x
/usr/local/sbin/certbot-auto --no-self-upgrade renew >> /var/log/le-renew.log
cp /etc/letsencrypt/live/${servername}/fullchain.pem /etc/pve/local/pve-ssl.pem
cp /etc/letsencrypt/live/${servername}/privkey.pem /etc/pve/local/pve-ssl.key
@Grynn
Grynn / tails.sh
Created September 6, 2020 10:56
Install tailscale
curl https://pkgs.tailscale.com/stable/ubuntu/`lsb_release -cs`.gpg | sudo apt-key add -
curl https://pkgs.tailscale.com/stable/ubuntu/`lsb_release -cs`.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt update
sudo apt install tailscale
@Grynn
Grynn / download-origins.sh
Last active July 20, 2020 16:29
crux-extract-origins
#!/bin/zsh
##Does not work with glocud version 298-301 (should be fixed in 302)
##https://github.com/GoogleCloudPlatform/gsutil/issues/1052
set -e -x -o pipefail
#Check tools
function check() {
which $1 >/dev/null || ( echo "$1 is needed; try brew install $1" ; exit 77 ; );
if [ "$?" -eq 77 ]; then exit; fi
@Grynn
Grynn / work-in-progress.js
Created May 15, 2020 15:47
Backup House Creatives
googletag.cmd.push(function() {
googletag.pubads().addEventListener('slotRenderEnded', function(e) {
let node = document.getElementById(e.slot.getSlotElementId());
if (e.isEmpty)
{
node.innerHTML = `
<p>NO CREATIVE</p>
<ul><li>Fade background?</li>
<li>Put a fake creative / hardcoded?</li>
</ul>