Skip to content

Instantly share code, notes, and snippets.

@thikade
thikade / salt_jinja_cheatsheet.md
Last active July 10, 2017 12:50
Salt Jinja Hintsheet
  • Use pillar['foo'] for required options to fail if they are not present!
  • alias functions for better code
{%- set pget = salt['pillar.get'] %}
{%- set dget = salt['defaults.get'] %}
{%- set mget = salt['mine.get'] %}
{{ pget("foo1", "default1") }}
{{ pget("foo2", "default2") }}
{{ dget("foo3") }}
{{ dget("foo4") }}
@thikade
thikade / wasdecode.md
Last active November 9, 2023 15:48
WebSphere wsadmin-embedded password en/decoder

Decode WAS password using wsadmin.sh:

./wsadmin.sh -lang jython -conntype none -c 'import com.ibm.ws.security.util.PasswordDecoder as pd; pd.main(["{xor}KzosK25tbH4n"]);'

Encode WAS password using wsadmin.sh:

./wsadmin.sh -lang jython -conntype none -c 'import com.ibm.ws.security.util.PasswordEncoder as pd; pd.main(["test123!x"]);'
@thikade
thikade / bash parameter expansion.md
Last active September 30, 2019 05:47
bash parameter expansion

How to make the 'cut' command treat several sequential delimiters as one?

cat text.txt | tr -s ' ' | cut -d ' ' -f4

From the tr man page:

-s, --squeeze-repeats   replace each input sequence of a repeated character
                        that is listed in SET1 with a single occurrence
                        of that character
@thikade
thikade / readme.md
Created February 14, 2017 10:27
reduce ext4 lvm filesystem
# Unmount the filesystem and check its' LV
umount /mnt/foo
e2fsck -f /dev/mapper/vg0-foo
 
# Shrink ext4 and then the LV to the desired size
resize2fs -p /dev/mapper/vg0-foo 40G
lvreduce -L 40G /dev/mapper/vg0-foo
 
# Before continuing, run e2fsck. If it bails because the partition
@thikade
thikade / readme.md
Last active February 13, 2017 13:37
OpenSSL Hintsheet

List ciphers

openssl ciphers -V

Extract Private Key

openssl pkcs12 -in key.p12 -passin pass:*** -passout pass: -nocerts -out key.pem -nodes

@thikade
thikade / readme.md
Created February 13, 2017 13:35
Extract Private key from PKCS12 to use with wireshark / ssldump

Extract private key

openssl pkcs12 -in key.p12 -passin pass:*** -passout pass: -nocerts -out key.pem -nodes

cat key.pem

ssldump -k ./key.pem port 9043

@thikade
thikade / Readme.md
Last active February 13, 2017 13:18
Find a class somewhere inside dozens of JAR files
@thikade
thikade / OPENSSL hints
Last active January 18, 2017 20:28
openssl tips & tricks
### Extract Private Key from PKCS12 file into PEM format
openssl pkcs12 -in key.p12 -passin pass:XXX -passout pass: -nocerts -out key.pem -nodes ; cat key.pem
ssldump -k ./key.pem port 9043
openssl ciphers -V | grep -i 0x9c
@thikade
thikade / createurls.py
Created December 7, 2016 13:45 — forked from bkonkle/createurls.py
A script to create urls for Jmeter testing from your Apache access logs.
#!/usr/bin/env python
"""
Requires apachelog. `pip install apachelog`
"""
from __future__ import with_statement
import apachelog
import csv
import re
import sys
from optparse import OptionParser