Skip to content

Instantly share code, notes, and snippets.

View xyzkpz's full-sized avatar
😮
I may be slow to respond.

kishan.panchal xyzkpz

😮
I may be slow to respond.
View GitHub Profile
@xyzkpz
xyzkpz / Jenkinsfile
Created September 27, 2021 15:47 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@xyzkpz
xyzkpz / Jenkinsfile
Created September 27, 2021 15:45 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@xyzkpz
xyzkpz / Send-SendGridMessage.ps1
Created September 25, 2021 13:13 — forked from pkskelly/Send-SendGridMessage.ps1
Sending Email from PowerShell using SendGrid (in Azure)
$Username ="azure_*********@azure.com"
$Password = ConvertTo-SecureString "********" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password
$SMTPServer = "smtp.sendgrid.net"
$EmailFrom = "[email protected]"
$EmailTo = "[email protected]"
$Subject = "SendGrid test"
$Body = "SendGrid testing successful"
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body
@xyzkpz
xyzkpz / mail_it.sh
Created September 25, 2021 13:12 — forked from beugley/mail_it.sh
bash script to send email as plain text or HTML, with attachments
#!/bin/sh
###############################################################################
## mail_it.sh
## A bash script that sends email as either plain text or HTML. It allows
## multiple recipients, CC addresses, reply-to addresses, and attachments.
##
## Usage: mail_it.sh -s subject -m message -f from_address
## -t to_address[,...] [-c cc_address[,...]] [-r reply_to_address[,...]]
## [-a attachment[,...]] [-h]
## subject: email subject
@xyzkpz
xyzkpz / sendmail
Created September 25, 2021 13:06 — forked from v9n/sendmail
Sending Email with mail
The Linux command line can be very powerful once you know how to use it. You can parse data, monitor processes, and do a lot of other useful and cool things using it. There often comes a need to generate a report and mail it out. It could be as simple a requirement as a notification that the day’s backup went through fine, or did not. I’ll help you get started with sending mails from the Linux command line and in shell scripts. We will also cover sending attachments from the command line. We will begin with the “mail” command.
MAIL
First run a quick test to make sure the “sendmail” application is installed and working correctly. Execute the following command, replacing “[email protected]” with your e-mail address.
# mail -s “Hello world” [email protected]
Hit the return key and you will come to a new line. Enter the text “This is a test from my server”. Follow up the text by hitting the return key again. Then hit the key combination of Control+D to continue. The command prompt will ask you if you want
@xyzkpz
xyzkpz / sendmail.sh
Created September 25, 2021 10:18 — forked from nikoheikkila/sendmail.sh
Bash: Send mail from command-line
#!/bin/bash
# Send a simple mail from shell with this script
# Niko Heikkila 2012
TO=$1
SUBJECT=$2
MSG=$3
BODY=$HOME/message.tmp
@xyzkpz
xyzkpz / psql_useful_stat_queries.sql
Created September 22, 2021 10:44 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@xyzkpz
xyzkpz / How to select records from last 24 hours using SQL?.txt
Last active September 23, 2021 07:54 — forked from ValchanOficial/gist:82c4fb2d6e9806a8dfb8c61f2440a6cc
How to select records from last 24 hours using SQL?
https://stackoverflow.com/a/1888569/11842937
In MySQL:
SELECT *
FROM mytable
WHERE record_date >= NOW() - INTERVAL 1 DAY
In SQL Server:
SELECT *
@xyzkpz
xyzkpz / postgres_queries_and_commands.sql
Created September 22, 2021 02:43 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
# Maintainer: Jakub Hajek, [email protected]
#
# docker stack deploy -c stack-elastic.yml elastic
#
# The stack creates Elasticsearch cluster consiting of
# - 3 dedicated master nodes in order to keep quorum
# - 4 dedicated data nodes to manage CRUD,
# - 2 coordination node acting like kind of load balancer in multi instance environments
#
#