Skip to content

Instantly share code, notes, and snippets.

@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 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

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 / bash parameter expansion.md
Last active September 30, 2019 05:47
bash parameter expansion
@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 / 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 / ansible_cheatsheet.md
Last active September 11, 2017 15:40
ansible cheat-sheet
@thikade
thikade / do_api_readme.md
Last active September 2, 2019 14:30
Filtering Digital Ocean API request using jq

Prereqs

export TOKEN=yourtoken

Display DO available droplet sizes

API Link

All sizes

@thikade
thikade / docker-machine.md
Created September 27, 2017 11:00
docker-machine cheatsheet

remove existing default machine:

docker-machine rm default

upgrade existing default machine:

docker-machine upgrade default

create NEW default machine:

docker-machine create -d virtualbox --virtualbox-memory 8192 --virtualbox-cpu-count "2" --virtualbox-disk-size "30000" default

set Graphics mem parameter

@thikade
thikade / openshift_inline_jenkinsfile.md
Created November 3, 2017 19:33
openshift tips and tricks
spec:
  nodeSelector: {}
  output: {}
  postCommit: {}
  resources: {}
  runPolicy: Serial
  strategy:
    jenkinsPipelineStrategy:
 env: