Skip to content

Instantly share code, notes, and snippets.

View ketankr9's full-sized avatar

Utsav Krishnan ketankr9

  • Google
  • Indian Institute of Technology (BHU), Varanasi,India
View GitHub Profile
@ketankr9
ketankr9 / commandLineBot.py
Created February 9, 2017 20:44
A simple code to access your raspberry pi(any linux system) commandLine remotely using Telegram chat_bot
import sys
import time
import telepot
import subprocess
def runProcess(chat_id,gotmsg):
str=[x.encode('utf-8') for x in gotmsg.split()]
try:
if "reboot" in str:
body="You can't use reboot, use 'shutdown -r hh:mm &' instead"
return
* know your public ip: ~$ `curl ipecho.net/plain; echo`
~$ `curl icanhazip.com`
* get headers only
curl -sI http://167.99.226.14:8000/tshirt.jpg
* split files and download: `https://www.maketecheasier.com/split-download-large-file-curl/`
curl --range 0-100000 -o song.mp3.part1 http://url/song.mp3
curl --range 100001- -o song.mp3.part2 http://url/song.mp3 #till end, remaining
#join file
cat song.mp3.part? > song.mp3
@ketankr9
ketankr9 / autoSSHlogin.sh
Created December 7, 2017 05:34
automated ssh login using expect
############### provide password of the login using script
#!/usr/bin/expect -f
spawn ssh username@host_ip
expect "username@remote_ip's password: "
send "password\r"
interact
###################################################
## B is my computer, A is the remote computer, transfer files from A to B.
@ketankr9
ketankr9 / draft0.md
Last active April 25, 2018 18:16
Feel free to comment below, this is the first draft, awaiting improvements :)

Introduction

HTTP Batch Sending

Syslog-ng is widely used cross-platform log management software, and being such an old software organization, the efficiency plays an important role.
This proposed project (HTTP batch sending) is an enhancement/improvement of the existing HTTP destination driver, enabling the ability to combine(batch) multiple messages as a single HTTP request, using libcurl based existing HTTP destination driver implementation.

Usefulness to the Community

One of the many characteristics which make a software stand among the crowd is the one who consumes fewer resources (network loads/uptime, processes load/uptime, etc.)

@ketankr9
ketankr9 / dreamWorld.sol
Last active March 25, 2018 10:22
Problem Statement 1 for CTF
pragma solidity ^0.4.6;
contract Question1 {
uint initialSupply = 100;
uint transactionCost = 1;
uint transactionCount = 0;
address owner;
@ketankr9
ketankr9 / smartContractTest.sh
Last active March 25, 2018 17:15
A simple bash script which processes all the sequence of programs required to run while ethereum smart contract developement.
#!/bin/bash
############################################################################################################
# The sequence of steps followed while developing and testing smartContracts are:
# 0. Starting the private network via ganache-cli
# 1. Modification of solidity code(.sol) or frontend(.html) file
# 2. Compilation of the solidity code(.sol) which generates (.abi) and (.bin) file with the contract's name
# 3. Changing frontend(.html) file such that the new (.abi) and code(.bin) is reflected.
# 4. Restarting HTTPServer such that the changes are reflected
# 5. Opening the browser and entering the ip:port
############################################################################################################
#!/usr/bin/python
import requests
import json
from time import sleep
import sys
headers={'x-oc-api-key':'6483389d2fa2802b97196b6b54ff487e', 'Content-Type': 'application/json'}
data = {'input': [{'source': '', 'type': 'remote'}], 'conversion': [{'target': 'mobi'}]}
response = dict()
@ketankr9
ketankr9 / Python
Last active April 29, 2018 14:53
Download torrent to your local server and sync it to your computer.
This file has been truncated, but you can view the full file.
@ketankr9
ketankr9 / instagram_tags.py
Last active May 10, 2018 06:46
A python script to scrape both "Most Recent" and "Top Posts" associated with any tag from Instagram.
import requests, json
class HashTag:
"""
This class helps in extracting image links associated with instagram hashtag, both recent and top posts.
"""
def __init__(self, tag, tagType="top_posts"):
"""
tag := the tag you are concerned with scraping
"""
@ketankr9
ketankr9 / scraper.py
Last active June 1, 2019 07:26 — forked from marcoqu/scraper.py
Script for scraping public instagram profile's timeline photos.
# pylint: skip-file
import time
import re
import md5
import requests
import json
INSTAGRAM_URL = "https://www.instagram.com"
HASHTAG_ENDPOINT = "/graphql/query/?query_hash={}&variables={}"