This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.SecureRandom | |
import java.util.Base64 | |
import javax.crypto.spec.{GCMParameterSpec, SecretKeySpec} | |
import javax.crypto.{Cipher, KeyGenerator, SecretKey} | |
object Cryptor { | |
def main(args: Array[String]): Unit = { | |
val cryptor = new Cryptor("84AmEdqF7YTruR2o4^2BfwkSA0weHtEVgHz$7Rqy".getBytes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- type: log | |
enabled: true | |
paths: | |
- /data/mssql2017/log/errorlog | |
multiline: | |
pattern: '^\t' | |
negate: false | |
match: after | |
fields: | |
log_type: mssql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# output.cer included all cert and key | |
openssl pkcs12 -in input.p12 -out output.cer -nodes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SCRIPT_PATH=${0%/*} | |
### Check version | |
VERSION=$1 | |
if [ ! -n "$VERSION" ]; then | |
echo "Missing version parameter. Use: $0 <VERSION>" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy remote database to local | |
pg_dump -C -h <<REMOTE_IP>> -U <<REMOTE_USER>> <<REMOTE_DB>> | psql -U <<LOCAL_USER>> <<LOCAL_DB>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, HostListener } from '@angular/core'; | |
@Directive({ | |
selector: '[enableTab]' | |
}) | |
export class EnableTabDirective { | |
constructor(private elementRef: ElementRef) { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}))" |
OlderNewer