Skip to content

Instantly share code, notes, and snippets.

@TiloGit
TiloGit / get_tds_cert.py
Last active August 6, 2019 22:40 — forked from lnattrass/get_tds_cert.py
A terrible way to connect to MS SQL Server and dump the certificate as a PEM
### run like:: python3 get_tds_cert.py mySQLserver 1433
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,
@TiloGit
TiloGit / Get_AzureApp.ps1
Last active February 9, 2023 16:12
Check Azure AD enterprise apps
Get-AzureADServicePrincipal -All:$true | ? {$_.Tags -eq "WindowsAzureActiveDirectoryIntegratedApp"} | Foreach-Object{
$AppObjectId = $_
$AppUser = Get-AzureADServiceAppRoleAssignment -ObjectId $AppObjectId.ObjectId #-All $true
New-Object -TypeName PSObject -Property @{
AppDisplayName = $AppObjectId.DisplayName
AppDisplayName2 = $AppObjectId.AppDisplayName
AppPublisherName = $AppObjectId.PublisherName
AppObjectId = $AppObjectId.ObjectId
@TiloGit
TiloGit / README
Created April 17, 2020 18:34 — forked from xbb/README
IDRAC6 Virtual Console Launcher
Use this as an example on how to start the virtual console without the need of Java Web Start or accessing it from the web interface.
You can use the user and password that you use for the web interface.
You need an old JRE... I used 1.7.0_80 from the Server JRE package, also I have tested successfully 1.7.0_79 with MacOS.
You don't need to install it, just extract it or copy the files in "jre" folder.
Open the viewer.jnlp file that you get by launching the virtual console from the web interface with a text editor.
Note the urls to the jar files. Download the main jar file avctKVM.jar and the libs for your operating system and architecture.
Extract the dlls (.so Linux, .jnilib MacOS) from the jar libs.
@TiloGit
TiloGit / main_AWS.py
Last active November 16, 2021 06:50
Duolingo via Phyton
def item_already_equipped(lingo, item):
if item == 'streak_freeze':
return lingo.__dict__['user_data'].__dict__['tracking_properties']['num_item_streak_freeze'] > 0
if item == 'rupee_wager':
return lingo.__dict__['user_data'].__dict__['tracking_properties']['has_item_rupee_wager']
def main(a, b):
import duolingo, os
username = os.environ['usernames']
@TiloGit
TiloGit / prom-k8s-request-limits.md
Created October 8, 2021 22:16 — forked from max-rocket-internet/prom-k8s-request-limits.md
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@TiloGit
TiloGit / dump-win-access-log.ps1
Created March 3, 2022 00:51
Simple export of win access log failures as csv
$result = Get-EventLog -LogName Security -InstanceId 4625 |
ForEach-Object {
[PSCustomObject]@{
Time = $_.TimeGenerated
Machine = $_.ReplacementStrings[6]
User = $_.ReplacementStrings[5]
Access = $_.ReplacementStrings[10]
SourceAddr = $_.ReplacementStrings[19]
}
}
@TiloGit
TiloGit / log4j2-azure-log-mon.xml
Last active March 23, 2022 19:34
log4j2 for azure log monitoring file ingestion
<RollingFile name="VFLOGMON"
filePattern="${sys:log.dir}/VFLOGMON/MyFlow-LogMon-%d{yyyy-MM-dd}-%i.log"
immediateFlush="true">
<PatternLayout alwaysWriteExceptions="false"
pattern="%d %-5p [%t] %C{2} (%F:%L) - %enc{%m}{CRLF} %replace{%throwable}{[\r|\n]}{|}%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true"/>
<SizeBasedTriggeringPolicy size="22 MB"/>
</Policies>
@TiloGit
TiloGit / fix-bitrate.ps1
Created March 31, 2022 22:23
set MS Teams Media bit rate (Kbs)
#PS use shell.azure.com
Connect-MicrosoftTeams -UseDeviceAuthentication
##use browser to login
##check value
Get-CsTeamsMeetingPolicy | select Identity, WhoCanRegister, MediaBitRateKb , RecordingStorageMode
##set to new value
Set-CsTeamsMeetingPolicy -Identity Global -MediaBitRateKb 50001
###output:
PS /home/tilo> Get-CsTeamsMeetingPolicy | select Identity, WhoCanRegister, MediaBitRateKb , RecordingStorageMode
@TiloGit
TiloGit / get-fn-addon-viajs.js
Created May 5, 2022 22:16
FileNet GCD Addon list (quick hack)
importClass(java.lang.System);
function OnCustomProcess (CEObject)
{
var objStor = CEObject.getObjectStore();
objStor.refresh();
var myDomain = objStor.get_Domain();
myDomain.refresh();
var AddOnListIterator = myDomain.get_AddOns().iterator();
var output = "";
@TiloGit
TiloGit / check-res.sh
Created June 17, 2022 21:20
Check HTTP reponse time via curl
#!/bin/bash
##from https://ops.tips/gists/measuring-http-response-times-curl/
##mod by allow self sign cert (-k)
# Set the `errexit` option to make sure that
# if one command fails, all the script execution
# will also fail (see `man bash` for more
# information on the options that you can set).
set -o errexit