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 / d7adp72.Dockerfile
Created July 25, 2021 12:54 — forked from Biker93/d7adp72.Dockerfile
Biker Drupal 7 Dockerfile
# docker build -t drupal:d7adp72 -f d7adp72.Dockerfile .
# docker image tag drupal:d7adp72 .../drupal:d7adp72
# docker push .../drupal:d7adp72
FROM php:7.2-apache
# install the PHP extensions we need
RUN set -ex; \
\
if command -v a2enmod; then \

Install suggested plugin

  • Folders Plugin
  • OWASP Markup Formatter Plugin
  • build timeout plugin
  • Credentials Binding Plugin
  • Timestamper Workspace Cleanup Plugin
  • Ant Plugin Gradle Plugin
  • Pipeline GitHub Organization
  • Folder Plugin
@xyzkpz
xyzkpz / docker.md
Created September 5, 2021 08:51 — forked from developerinlondon/docker.md
Docker saving and loading images

Here's how to save and load docker images:

Example scenario: To save a docker image from a docker repository and save it as a tar file locally.

  1. Save the image as a tarball

docker save repositoryname:tag > repotag.tar

  1. Zip the image
@xyzkpz
xyzkpz / postgres-backup.sh
Created September 11, 2021 11:41 — forked from 4410287/postgres-backup.sh
Shell script for daily postgres database backup with basic archiving.
#!/bin/bash
# Written 2018-11-15 by 4410287
# This script will create a backup file of a postgres database and compress it. It is capable of access a local or remote server to pull the backup. After creating a new backup, it will delete backups that are older than 15 days, with the exception of backups created the first of every month. It is recommended to create a seperate database user specifically for backup purposes, and to set the permissions of this script to prevent access to the login details. Backup scripts for different databases should be run in seperate folders or they will overwrite each other.
HOSTNAME=
USERNAME=
PASSWORD=
DATABASE=
# Maintainer: Jakub Hajek, jakub.hajek@cometari.com
#
# 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
#
#
@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%'
@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 / 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 / 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 / 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 “you@youremailid.com” with your e-mail address.
# mail -s “Hello world” you@youremailid.com
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