Skip to content

Instantly share code, notes, and snippets.

View mskian's full-sized avatar
🦕
Focusing

Santhosh Veer mskian

🦕
Focusing
View GitHub Profile
@mskian
mskian / gfycli.yaml
Last active March 28, 2022 11:38
Gotify Python CLI for Termux - Send Messages to the Gotify/server
# Url of the Gotify server (including the protocol to use)
url: 'https://push.example.com'
# Default notification parameters
default:
token: 'XXXXXXXXXXXXXX'
title: 'Hello World'
message: 'Hello Push From Python CLI'
priority: 5
@mskian
mskian / stats.example.com.conf
Last active May 16, 2019 06:56
Nginx Configuration for Fathom Website Analytics 📊
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name stats.example.com;
root /var/www/stats;
@mskian
mskian / repo-reset.md
Created May 2, 2019 10:24 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@mskian
mskian / server.sh
Last active April 11, 2019 06:11
Bash shell Script to Get website Down Notification on Pushbullet
#!/bin/bash
# Enter your Domain(Don't add http infront of the domain) or Server IP
HOST="127.0.0.1"
# Pushbullet API Key
PUSHBULLET="<PUSHBULLET API KEY>"
# Ping the Host
ping -c 3 $HOST > /dev/null 2>&1
@mskian
mskian / status.sh
Last active April 11, 2019 15:09
Website HTTP Status Checker - Get Monitor Notification on Pushbullet
#!/bin/bash
# Purpose: Website HTTP Status Checker
# Source: https://gist.github.com/mskian/6f49b45e74ab5c0ef1c5e266bcfa22c9
# Developer: Santhosh Veer
# Domain to check
DOMAIN="https://example.com"
# Pushbullet API Key - https://docs.pushbullet.com/
@mskian
mskian / code.gs
Created April 1, 2019 03:50
Google APP Script - Google Form Submit Notifications to Pushbullet
function onFormSubmit(e) {
var url = "https://api.pushbullet.com/v2/pushes";
var responses = ' ';
var form = FormApp.openById('<FormID>'); // https://docs.google.com/forms/d/FormID/edit
var formResponses = form.getResponses();
var formResponse = formResponses[formResponses.length - 1];
var itemResponses = formResponse.getItemResponses();
var customerNameresponse = itemResponses[0];
var mrrresponse = itemResponses[2];
responses = responses + customerNameresponse.getResponse();
@mskian
mskian / nordvpn.py
Created February 25, 2019 09:39
Python to Check the Connection Status of a NordVPN
import sys
import json
import time
import requests
from halo import Halo
spinner = Halo(text='Loading', color='green', spinner='hamburger')
try:
spinner.start()
@mskian
mskian / linebreak.md
Created January 3, 2019 05:25
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World


@mskian
mskian / post-mortem.md
Created December 19, 2018 17:46 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@mskian
mskian / pushbullet.sh
Last active April 11, 2019 06:31
Bash Shell Script to Send Push Notes to your Devices Which Connected with Pushbullet
#!/bin/bash
# -----------------------------------------------------------------------------
# Info:
# author: Santhosh Veer
# file: pushbullet.sh
# created: 03.10.2018
# revision: 03.10.2018
# version: 0.1
# -----------------------------------------------------------------------------