Skip to content

Instantly share code, notes, and snippets.

View dipayandutta's full-sized avatar
👨‍💻
working

Dipayan dipayandutta

👨‍💻
working
  • Kolkata
  • 08:43 (UTC +05:30)
View GitHub Profile
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@dipayandutta
dipayandutta / app.py
Created April 13, 2018 06:58 — forked from rduplain/app.py
Plot a PNG using matplotlib in a web request, using Flask.
"Plot a PNG using matplotlib in a web request, using Flask."
# Install dependencies, preferably in a virtualenv:
#
# pip install flask matplotlib
#
# Run the development server:
#
# python app.py
#
@dipayandutta
dipayandutta / SmartWorkx,Conel_check_connection_2_IP.md
Created December 4, 2017 08:14 — forked from tomasinouk/SmartWorkx,Conel_check_connection_2_IP.md
Script for SmartWorkx, Conel routers to check connection against 2 IP addresses. Good solution, to engage failover after both servers are not reachable.

Here is the start-up script, which in effect does check of 2 IP addresses

#!/bin/sh
#
# This script will be executed when PPP/WAN connection is established.
#
# Script for checking connection by two ping ip addresses
#
# Put checking ip addresses
@dipayandutta
dipayandutta / gist:80d264b0207f578551cf01e4a04a238b
Created December 4, 2017 08:02 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot)
# some examples of SNAT, DNAT with iptables with comments:
# mainly used in start-up script
# masquarade all outgoing packets to be WLAN0 IP
iptables -t nat -A PREROUTING -s 192.168.1.2 -i eth0 -j MASQUERADE
# All packets leaving eth0 will have src eth0 ip address
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 192.168.1.1
# match rule specifying a source port
@dipayandutta
dipayandutta / iptables_rules.sh
Created December 2, 2017 06:30 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP