Skip to content

Instantly share code, notes, and snippets.

View navjotjsingh's full-sized avatar
🏠
Working from home

Navjot Singh navjotjsingh

🏠
Working from home
View GitHub Profile
# Put this in nrpe.cfg on the remote host you're monitoring.
command[check_load]=/usr/local/nagios/libexec/check_load -w 5,4,3 -c 10,8,6
command[check_memory]=/usr/local/nagios/libexec/check_mem.pl -f -w 5 -c 2
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
@r4um
r4um / airtel-usage.rb
Created August 21, 2012 09:57
Display Airtel broadband usage.
#!/usr/bin/env ruby
# Display airtel broadband usage. Output format is
# airtel_id/quota GB/used GB/days_left
require 'rubygems'
require 'nokogiri'
require 'open-uri'
page = Nokogiri::HTML(open("http://122.160.230.125:8080/gbod/gb_on_demand.do", 'User-Agent' => 'curl/7.26.0', 'Accept' => "*/*"))
@purwandi
purwandi / 01-Nginx-Naxsi-Core.md
Last active January 4, 2021 12:10
Install nginx, naxsi core and naxsi ui

Install Some Dependencies

apt-get install build-essential bzip2 libpcre3-dev libssl-dev mysql-server daemon libgeoip-dev

Installing Nginx with Naxsi Core

Download Nginx, Naxsi Core dan Naxsi UI. Saya berasumsi tempat download berada di /home/compile

@coenjacobs
coenjacobs / wc-custom-product-order.php
Created June 18, 2013 09:32
Adds a custom way of ordering products, in this example it's 'random' product ordering. This can also be set to be used as default via the Catalog tab in WooCommerce settings.
<?php
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'random_list' == $orderby_value ) {
$args['orderby'] = 'rand';
$args['order'] = '';
@jameskoster
jameskoster / functions.php
Last active December 19, 2015 17:48
Highwind - remove the header gravatar
add_filter( 'highwind_header_gravatar', '__return_false' );
@jameskoster
jameskoster / functions.php
Created July 16, 2013 17:39
Highwind - Add your own header image
add_action( 'highwind_site_title_link', 'jk_custom_header_image' );
function jk_custom_header_image() {
?>
<img src="path/to/your/image.png" class="avatar" />
<?php
}
@stevenchanin
stevenchanin / digitalocean.md
Last active December 20, 2021 17:18 — forked from JamesDullaghan/digitalocean.md
Setup instructions for Digital Ocean VPS using Ubuntu and Rails 3.2 #digitalocean #vps #setup

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create Droplet

Create droplet of your liking (ubuntu 12.04 x32) Use an xx.04 LTS version

Setup DNS

On Digital Ocean, create a DNS entry for your server (xyz.com)

Make sure it has NS records that use digital oceans nameservers

@adamstac
adamstac / gist:7462202
Last active October 30, 2024 21:02
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@kloon
kloon / functions.php
Last active July 4, 2017 11:27
WooCommerce add payment type to emails
<?php
// Place the following code in your theme's functions.php file to add the payment type to all emails
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_emails', 15, 2 );
function wc_add_payment_type_to_emails( $order, $is_admin_email ) {
echo '<p><strong>Payment Type:</strong> ' . $order->payment_method_title . '</p>';
}
// Place the following code in your theme's functions.php file to add the payment type to admin emails only
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_admin_emails', 15, 2 );
function wc_add_payment_type_to_admin_emails( $order, $is_admin_email ) {
@fastmover
fastmover / setupsoftware.sh
Last active October 24, 2022 13:07
Auto install software for new Mac Setup.
#!/bin/bash
mkdir ~/getmacapps_temp
cd ~/getmacapps_temp
# Installing Chrome
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
hdiutil mount googlechrome.dmg
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications
hdiutil unmount "/Volumes/Google Chrome"