Skip to content

Instantly share code, notes, and snippets.

View Ksisu's full-sized avatar

Kristóf Horváth Ksisu

View GitHub Profile
@Ksisu
Ksisu / gist:56ad22f07f79c7c7b3ac4d7505a975b1
Created December 16, 2022 15:37
get aws style ssh fingerprint
openssl rsa -in ssh_private_key_file -pubout -outform DER | openssl md5 -c
@Ksisu
Ksisu / check_ssl.sh
Created January 24, 2022 12:34
Check ssl exp date script
#!/bin/bash
gracedays=14
result=0
for server in example.com www.example.com other-test.com; do
data=`echo | openssl s_client -connect "${server}:443" -servername "${server}" 2>/dev/null | openssl x509 -noout -enddate | sed -e 's#notAfter=##'`
ssldate=`date -d "${data}" '+%s'`
nowdate=`date '+%s'`
diff="$((${ssldate}-${nowdate}))"
@Ksisu
Ksisu / enable-tab.directive.ts
Last active September 14, 2020 07:36
Angular enable tabulator on input field
import { Directive, ElementRef, HostListener } from '@angular/core';
@Directive({
selector: '[enableTab]'
})
export class EnableTabDirective {
constructor(private elementRef: ElementRef) {
}
@Ksisu
Ksisu / psql_copy_database.sh
Created June 9, 2020 07:27
PSQL copy database
# Copy remote database to local
pg_dump -C -h <<REMOTE_IP>> -U <<REMOTE_USER>> <<REMOTE_DB>> | psql -U <<LOCAL_USER>> <<LOCAL_DB>>
@Ksisu
Ksisu / deploy.sh
Last active November 14, 2019 09:58
Simple symlink style deploy script
#!/bin/sh
SCRIPT_PATH=${0%/*}
### Check version
VERSION=$1
if [ ! -n "$VERSION" ]; then
echo "Missing version parameter. Use: $0 <VERSION>"
exit 1
fi
@Ksisu
Ksisu / _zulip_send.sh
Created November 6, 2019 21:28
bash function for send message to zulip
#!/bin/bash
source /home/__TODO__/.bashrc # only need if use from cron
ZULIP_MESSAGES_API="https://__TODO__/api/v1/messages"
ZULIP_BOT_EMAIL_ADDRESS="__TODO__"
ZULIP_BOT_API_KEY="__TODO__"
ZULIP_STREAM="DevOps Technical"
ZULIP_TOPIC="(no topic)"
function zulipSend {
@Ksisu
Ksisu / KeyGenerator.scala
Created October 20, 2019 18:03
ECDSA + RSA keygen
object KeyGenerator {
import java.security.{KeyPair, KeyPairGenerator}
import java.util.Base64
def generateECDSAKeyPair: (String, String) = {
import java.security.spec.ECGenParameterSpec
import java.security.{SecureRandom, Security}
import org.bouncycastle.jce.provider.BouncyCastleProvider
@Ksisu
Ksisu / p12_to_pem.sh
Last active February 4, 2019 10:50
p12 -> pem
# output.cer included all cert and key
openssl pkcs12 -in input.p12 -out output.cer -nodes
@Ksisu
Ksisu / filebeat.yml
Created November 29, 2018 00:17
SQL Server log filebeat logstash
- type: log
enabled: true
paths:
- /data/mssql2017/log/errorlog
multiline:
pattern: '^\t'
negate: false
match: after
fields:
log_type: mssql
#!/bin/bash
if [[ -n "${GTM_CONTAINER_ID}" ]]; then
CODE="<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','$GTM_CONTAINER_ID');</script>"
sed -i "s#</head>#${CODE}</head>#g" /usr/share/nginx/html/index.html
CODE="<noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=${GTM_CONTAINER_ID}\" height="0" width="0" style=\"display:none;visibility:hidden\"></iframe></noscript>"
sed -i "s#</body>#${CODE}</body>#g" /usr/share/nginx/html/index.html
fi