Skip to content

Instantly share code, notes, and snippets.

require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.09/sshpass-1.09.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 '71746e5e057ffe9b00b44ac40453bf47091930cba96bbea8dc48717dedc49fb7'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
@nisargshah95
nisargshah95 / send-new-ip.sh
Created July 10, 2018 18:26
Send an email whenever public IP address changes
# The script sends an email with updated IP address
# whenever there is an IP change from ISP
MSG="To: myemail@gmail.com\nFrom: myemail@gmail.com\nSubject: New IP\n"
IP_FILE=/home/nisarg/ip-address.txt
IP=$(/usr/bin/dig +short myip.opendns.com @resolver1.opendns.com)
OLD_IP=$(cat $IP_FILE)
if [ "$IP" != "$OLD_IP" ]; then
echo $IP > $IP_FILE # save new IP to file
MSG="$MSG\n$IP\n" # add IP to message body
@nisargshah95
nisargshah95 / dummy-web-server.py
Created February 15, 2018 06:04 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@nisargshah95
nisargshah95 / GSoC2016Submission.md
Last active August 22, 2016 18:18
Final submission for GSoC 2016

GSoC 2016 final submission

Submitted by Nisarg Shah

Project - [GUI-based FTP client for KolibriOS] (https://summerofcode.withgoogle.com/projects/#5072256724107264)

Tasks accomplished

  1. Add proper error handling [Modification]
  2. Refactor code to decouple console code and core FTP code [Flow diagram] [Modification]
  3. Console
#Implementation of 'Game of Sticks' (http://nifty.stanford.edu/2014/laaksonen-vihavainen-game-of-sticks/handout.html)
#Instructions
#In the game of sticks there is a heap of sticks on a board.
#On their turn, each player picks up 1 to 3 sticks.
#The one who has to pick the final stick will be the loser.
import random
hats=[0]