Skip to content

Instantly share code, notes, and snippets.

View davidedg's full-sized avatar
🎯
Focusing

Davide Del Grande davidedg

🎯
Focusing
View GitHub Profile
@davidedg
davidedg / true-nas-scale-ntfs-install.md
Created October 8, 2024 20:31
TrueNAS-SCALE-NTFS-3g

TrueNAS-SCALE NTFS-3G

(Tested on TrueNAS-SCALE 24.10-RC1)

DEBIANVER=$(lsb_release -cs 2>/dev/null)
DEBARCH_ALTMETHOD=$(/usr/bin/dpkg-query --print-avail | grep Architecture| grep -v all|uniq|cut -d' ' -f2)

CUSTOMPARENT=ntfs

@davidedg
davidedg / get_tds_cert.py
Created March 1, 2023 21:29 — forked from lnattrass/get_tds_cert.py
A terrible way to connect to MS SQL Server and dump the certificate as a PEM
import sys
import pprint
import struct
import socket
import ssl
from time import sleep
# Standard "HELLO" message for TDS
prelogin_msg = bytearray([ 0x12, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x06, 0x01, 0x00, 0x20,
0x00, 0x01, 0x02, 0x00, 0x21, 0x00, 0x01, 0x03, 0x00, 0x22, 0x00, 0x04, 0x04, 0x00, 0x26, 0x00,
@davidedg
davidedg / ssm_parameter_store.py
Created September 10, 2019 07:22 — forked from nqbao/ssm_parameter_store.py
Python class to provide a dictionary-like interface to access AWS SSM Parameter Store easily
# Copyright (c) 2018 Bao Nguyen <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
if (-not ("win32.nativemethods" -as [type])) {
add-type -Namespace Win32 -Name NativeMethods -MemberDefinition @"
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr SendMessageTimeout(
IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam,
uint fuFlags, uint uTimeout, out UIntPtr lpdwResult);
"@
}
$HWND_BROADCAST = [intptr]0xffff;
@davidedg
davidedg / activemq-jdbc.txt
Last active June 12, 2018 21:46
ActiveMQ: configure PostgreSQL for Message Persistence
Sources:
https://www.linkedin.com/pulse/activemq-configure-postgresql-message-persistence-syed-shabbir/
https://access.redhat.com/documentation/en-us/red_hat_jboss_a-mq/6.2/html-single/configuring_broker_persistence/index#FuseMBPersistJDBCStore
https://issues.apache.org/jira/browse/AMQ-6780?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
-------------------------------------------------------------------------
When the versioning format changed for JDBC driver between 9.4.1212 and 42.0.0 so did the name from "postgres_native_driver" to "postgres_jdbc_driver"
The PostgresqlJDBCAdapter uses the name to find the class but has no reference for postgres_jdbc_driver
@davidedg
davidedg / ct-submit.py
Last active March 30, 2018 23:54 — forked from rraptorr/ct-submit.py
Simple Certificate Transparency certificate submission client
#!/usr/bin/python
import sys
import argparse, json, base64, struct
import urllib2
from datetime import datetime
## https://crt.sh/monitored-logs
LOGS = {
'rocketeer': 'https://ct.googleapis.com/rocketeer',
@davidedg
davidedg / frontend-connect
Created November 7, 2017 10:59
Frontend Connectiol Tool
#!/bin/bash
export LOGTAG="frontend-connect"
function log { logger -t $LOGTAG -- $1; }
function die {
[[ -n "$1" ]] && log "$1"
echo "$1"
exit 1
}
@davidedg
davidedg / USERDATA
Last active April 6, 2024 03:39
AWS NAT Instance HA
#!/bin/bash
#https://gist.github.com/davidedg/c29c478ee9c15a804a99cbd1de364647#file-userdata
# Intended to run together with AMI amzn-ami-vpc-nat-hvm-*, with ASG min=max=desired=1
# Tested with amzn-ami-vpc-nat-hvm-2018.03.0.20180811-x86_64-ebs (ami-0ea87e2bfa81ca08a)
# Expected TAGS:
# - Backend Subnets: Name=InternetNAT Values=AvailabilityZone ( eg: eu-west-1 ) where Frontend NAT Instance is (this allows for multiple NAT instances to serve differenze AZ subnets
# - Backend Subnets + ASG: Name=Environment, Values=EnvironmentLabel ( eg: "production", "staging" ... ) (this allows for multiple environments in same VPC, served by different NAT instances)
# - ASG: Name=EIP Values=EIP-allocation-id ( eg eipalloc-abcdef12 )
PATH="/usr/sbin:/sbin:/usr/bin:/bin"
function log { logger -t "NAT-instance" -- $1; }