Skip to content

Instantly share code, notes, and snippets.

Avatar

Gautam krishna R gautamkrishnar

View GitHub Profile
@gautamkrishnar
gautamkrishnar / README.md
Last active July 10, 2022 09:31
Shell script to force kill a Proxmox VE VM when it stop responding using the VM ID
View README.md

Usage

./kill-vm.sh <vm_id>
@gautamkrishnar
gautamkrishnar / bsnl_usage.5m.sh
Last active April 14, 2022 20:20
Automated script to fetch current and daily BSNL network usage and show it on your MacOS menu bar
View bsnl_usage.5m.sh
#!/usr/bin/env bash
curl 'https://redirect1.bbportal.bsnl.co.in/portal/fetchUserQuotaPM.do' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36' \
--data-raw \
'actionName=manual&_search=false&rows=4&page=1&sidx=&sord=asc' \
--silent | /usr/local/bin/jq --raw-output '.rows[0] | "\(.totalUsage)\n---\nToday \(.dailyTotalUsage)"'
View example.yaml
name: Release Image
on:
push:
tags:
- v*
jobs:
publish-image:
name: Publish Image
runs-on: ubuntu-latest
@gautamkrishnar
gautamkrishnar / main.py
Last active October 23, 2021 11:44
Python code to split a large PDF file into muliple files
View main.py
import PyPDF2
input_pdf = PyPDF2.PdfFileReader(open("document.pdf", "rb"))
num_of_pages_per_file = 10
doc_counter = 1
counter = 0
output = PyPDF2.PdfFileWriter()
for split_range in [range(input_pdf.numPages)[x:x + num_of_pages_per_file] for x in
range(0, input_pdf.numPages, num_of_pages_per_file)]:
@gautamkrishnar
gautamkrishnar / keybase.md
Last active October 29, 2017 10:29
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am gautamkrishnar on github.
  • I am gkrish (https://keybase.io/gkrish) on keybase.
  • I have a public key ASA7kdEWVJClHLW8EkVu1aRXGE9Ldn6JuZOrPHEAbpS7CQo

To claim this, I am signing this object:

@gautamkrishnar
gautamkrishnar / pinger.py
Created July 30, 2017 11:22
A python script to increase the views of your pastebin profile. See the results: https://pastebin.com/u/gautamkrishnar
View pinger.py
import requests
import threading
import os
import random
pastebinurl = "https://pastebin.com/u/gautamkrishnar"
def loaduseragents():
"""
Loads the list of user agents from user_agents.txt
:return:
"""
@gautamkrishnar
gautamkrishnar / lib.py
Created July 13, 2017 06:40
A simple python thread based random number generator
View lib.py
import threading
x=0 #to get a random number
killswitch = False # To kill thread after use
def threaded_return(que):
"""
Returning data from thread safely (Returns current value of x)
:param que:
:return:
"""
global x
@gautamkrishnar
gautamkrishnar / multiprocessing.py
Created July 12, 2017 11:04
simple program to do python multiprocessing
View multiprocessing.py
import multiprocessing as mp
process_list = []
def pr1(test,test1):
"""
@:param: test,test1 (Integer)
process 1
"""
print("Pr 1 prining... '"+str(test)+"','"+str(test1)+"' recieved...")
@gautamkrishnar
gautamkrishnar / english-words.py
Created December 27, 2016 08:54
Script to generate a coma seporated file(.csv) from a given input file with normal english words and unicode characters...
View english-words.py
from nltk.corpus import wordnet #Using Natural language toolkit (http://www.nltk.org/)
import codecs
def check(str):
if not wordnet.synsets(str):
return 1
else:
return 0
a=0
if __name__ == '__main__':
View sri.go
package sri
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io/ioutil"
)
func Generate256(file string) (string, error) {