Skip to content

Instantly share code, notes, and snippets.

View jadia's full-sized avatar
💭
Progress beats Perfect.

Nitish Jadia jadia

💭
Progress beats Perfect.
View GitHub Profile
@jadia
jadia / youtube-dl_playlist_formatted.md
Created January 31, 2019 13:35
youtube-dl playlist download command

Download playlist using youtube-dl in formatted manner

sudo youtube-dl -ic -o '%(playlist_index)s. %(title)s.%(ext)s' https://www.youtube.com/.....
@jadia
jadia / git_deleted_files.md
Last active February 1, 2019 05:05
Git commit all deleted files

Git commit all deleted files

git add -u

man from git-add

-u, --update
@jadia
jadia / config_edit_script.md
Created February 7, 2019 11:30
Change entry in a config file

Change an entry in a config file using sed in bash.

sed -r '/PasswordAuthentication/ s/^#/ /; s/(PasswordAuthentication ).*$/\1 no/' ssh_config
        ^ pattern to match        ^remove                             ^ change value
                                  comment
@jadia
jadia / noOfSSHconnections.md
Created May 30, 2019 06:33
Check number of SSH connection to the server
sudo netstat -tpna | grep 'ESTABLISHED.*sshd'
@jadia
jadia / createCertDocker.md
Created June 20, 2019 09:59
Create docker certificate using Docker Image
docker run -it --rm --name certbot -v "/root/letsencrypt/etc/letsencrypt:/etc/letsencrypt" -v "/root/letsencrypt/ssl/var/lib:/var/lib/letsencrypt" -v "/root/letsencrypt/ssl/cloudflare.ini:/tmp/cloudflare.ini:ro" certbot/dns-cloudflare certonly --server https://acme-v02.api.letsencrypt.org/directory --agree-tos --dns-cloudflare --dns-cloudflare-credentials /tmp/cloudflare.ini --dns-cloudflare-propagation-seconds 60 --email nitish.jadia@rtcamp.com --manual-public-ip-logging-ok --no-eff-email --renew-by-default --text -d nitish.rt.gw
@jadia
jadia / certbotDocker.md
Created June 21, 2019 13:31
Create certificates for your website using Certbot

Create certificates for your website using Certbot

mkdir $PWD/certbotFiles/ && \
docker run -it --rm --name certbot \
-v "$PWD/certbotFiles/etc/letsencrypt:/etc/letsencrypt" \
-v "$PWD/certbotFiles/var/lib:/var/lib/letsencrypt" \
-p 80:80 \
certbot/certbot certonly \
--standalone \
@jadia
jadia / getTeamListGithub.md
Created July 9, 2019 07:12
Get all team members list using Github API v3

Get list of all the teams in your organization

GITHUB_TOKEN=<YOUR-GITHUB-TOKEN-WITH-org:read-CHECKED>
GITHUB_ORG=<YOUR ORGANIZATION>
curl -sH "Authorization: token $GITHUB_TOKEN" https://api.github.com/orgs/$GITHUB_ORG/teams\?per_page\=100

Note the "id": for the Team of your choice Ex: "id": 68705"

@jadia
jadia / ansible_check_process_status.yaml
Last active July 16, 2019 14:43
Ansible: Check if a process is already running
# Check if process is already running if not then set the false flag
- name: Check if authCheck process is running
shell: |
bash -c "if lsof /usr/local/sshAuthKeyNotify.sh ; then
echo 'Process ALREADY running'
true
else
echo 'PROCESS NOT RUNNING'
false
fi"
@jadia
jadia / certbotCommand.md
Created July 18, 2019 09:48
Create certificates for website using certbot

create a clone of certbot git repo or install certbot

sudo ./certbot-auto certonly -m test@example.com --agree-tos --manual --no-eff-email --manual-public-ip-logging-ok --preferred-challenges http  -d test1.example.com

This will give crt and key.

@jadia
jadia / mysqlDumpDatabase.md
Created July 19, 2019 07:14
Take MySQL dump of a database

Take MySQL dump of a database or backup the database

mysqldump -u root -pYOUR-PASSWORD-HERE DATABASE-NAME > myDbData.sql

P.S.:- No space between your passowrd and -p

Todo: