Skip to content

Instantly share code, notes, and snippets.

View ggrandes's full-sized avatar
🛠️
I may be slow to respond.

G.Grandes ggrandes

🛠️
I may be slow to respond.
View GitHub Profile
@ggrandes
ggrandes / openssl-smime.sh
Last active December 21, 2023 07:15
OpenSSL S/MIME 3.1 (CMS) - Encrypt/Signature - Verify/Decrypt
# Original Source:
# https://gist.github.com/ggrandes/a57c401f1bad6bd0ffd87a557b7b5790
# SIGN / VERIFY
openssl cms -sign -keyid -md sha256 -nodetach -binary -in /etc/passwd -signer user.crt -inkey user.key -out x.smime -outform SMIME
openssl cms -verify -CAfile ca.crt -in x.smime -inform SMIME
# ENCRYPT / DECRYPT
openssl cms -encrypt -keyid -aes-256-cbc -in /etc/passwd -binary -out x.smime -outform SMIME user.crt
openssl cms -decrypt -in x.smime -inform SMIME -recip user.crt -inkey user.key
@ggrandes
ggrandes / pocket_screen_cheatsheet.md
Last active September 27, 2022 08:44
Pocket Screen Cheatsheet

Screen Cheatsheet / Quick Reference (Pocket Friendly)

Escape Key

All screen commands are prefixed by an escape key, by default Ctrl-a (that's Control-a, sometimes written ^a). To send a literal Ctrl-a to the programs in screen, use Ctrl-a a. This is useful when when working with screen within screen. For example Ctrl-a a n will move screen to a new window on the screen within screen.

Description Command
Basic
Start a new session with session name screen -S
@ggrandes
ggrandes / HTMLDocumentEditor.java
Created May 7, 2022 07:37
Charles Bell's HTMLDocumentEditor
/* HTMLDocumentEditor.java
* @author: Charles Bell
* @version: May 27, 2002
*/
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
@ggrandes
ggrandes / regex-ipv4.md
Created March 27, 2022 20:29
Regular Expression - IPv4 (Perl / Java)
Match: 0.0.0.0-255.255.255.255

Perl / PCRE

$input =~ /^(?:(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?1)$/;
grep -P '^(?:(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?1)$' <<<"$input"
@ggrandes
ggrandes / tomcat7-deploy.sh
Last active March 6, 2022 16:52
Automatic Deploy of Apache Tomcat (7.0.x; DEPRECATED; EOL 31/03/2021) and Log4J (1.2.x) (Linux)
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ggrandes
ggrandes / cert-generator-with-int.sh
Last active September 9, 2021 11:53
Generate X.509 Certificate (Server/Client/Mail) with OpenSSL and Intermediate CA - Linux
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Original Source:
# https://gist.github.com/ggrandes/c1765904e804db15b8c57d90299d006f
#
@ggrandes
ggrandes / markdown-bootstrap.pl
Last active November 26, 2019 19:48
Extract files and scripts from Markdown CodeBlocks for Bootstraping
#!/usr/bin/perl -wT
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ggrandes
ggrandes / prompt.sh
Last active November 26, 2019 19:48
Linux Colored Prompt
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ggrandes
ggrandes / cert-generator.sh
Last active November 26, 2019 19:48
Generate X.509 Certificate (Server/Client/Mail) with OpenSSL - Linux
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ggrandes
ggrandes / cert-ecc-generator.sh
Last active November 26, 2019 19:48
Generate ECC X.509 Certificate (Server/Client/Mail) with OpenSSL - Linux
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.