Skip to content

Instantly share code, notes, and snippets.

View krishnachaitanya7's full-sized avatar
🎯
Focusing

Krishna Chaitanya krishnachaitanya7

🎯
Focusing
View GitHub Profile
@krishnachaitanya7
krishnachaitanya7 / ovpn_cert_extractor
Created April 11, 2015 16:43
python script used to extract certificates from ovpn file usage: python ovpn_cert_extractor.py file_name_of_ovpn.ovpn
import sys
import re
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
fr = open(sys.argv[1],'r')
@krishnachaitanya7
krishnachaitanya7 / wall_changer.py
Last active July 30, 2017 09:08
#directions to use- place this python file in a folder containing wallpapers and run the python code. That's it. and importantly #run the code as non-sudo user!
#directions to use- place this python file in a folder containing wallpapers and run the python code. Thats it. and importantly #run the code as non-sudo user!
#/usr/bin/env python
import os
from subprocess import call
import glob
import time
wall_change_time = 10
def set_wallpaper(image_file_with_path):
filepath = os.path.abspath(image_file_with_path)
call(['gsettings', 'set', 'org.gnome.desktop.background', 'picture-uri', 'file://%s' % (filepath)])
@krishnachaitanya7
krishnachaitanya7 / Tracker_update.py
Last active August 30, 2015 16:54
Many of them copy tracker URL's from internet to paste them for torrent downloading to get started, but adding them is a bit boring work. finding which tracker URL is already present. Let computer do that. Read the instructions to use in this Gist
'''
make a python file and name it whatever you want. make a text file named trackers.txt and paste all the list of exhaustive trackers in that text file. now copy the tracker url's you have obtained from the torrent file to the clipboard and run this python script. now paste the exhaustive list into your torrent downloading software along with updated url's you have obtained from the torrent file. Any new url's will be automatically updated in tracker.txt file. this script uses boyer moore horspool string searching algorithm
If it helped you i would love to hear from you. i would also be grateful if you post it in any of your groups and somebody uses it. mail me or message me: chaitanyaradon89@gmail.com, kcradon11@facebook.com
'''
import pyperclip
def BoyerMooreHorspool(pattern, text):
m = len(pattern)
@krishnachaitanya7
krishnachaitanya7 / VPNBook_password_updater_Ubuntu.py
Last active August 24, 2021 22:16
I use vpnbook for all my vpn requirements. But they change the password repeatedly. Going to their website note down the password and put them back in VPN config is a robotic work. So i just automated it with python. This script automates the work, By browsing the website extracting the password and saving it to the required config files
'''
Tested in ubuntu 14.04 LTS
Usage: If you dont want the proxy you can comment out the lines 18,19,20
line_writer first argument is the file path which you need to put, then script will update password in that file
i would love to hear from you, hope this script helps you- Email:chaitanyaradon89@gmail.com
'''
from bs4 import BeautifulSoup
import fileinput
import sys
import urllib2
@krishnachaitanya7
krishnachaitanya7 / Encrypted_Password_Generator.py
Created March 16, 2016 14:54
This script will help you create strong passwords which is required these days when used to fill sign-up forms, Maybe useful in signing-up for university admissions, or your own password to access raspberry pi, applications are wherever there is a need of strong password
'''This script will help you create strong passwords which is required these days when used to fill sign-up forms'''
import hashlib
import pyperclip
import sys
def find_pass(secret_string):
s = hashlib.md5(secret_string).hexdigest()[0:10]
for i, c in enumerate(s):
if not c.isdigit():
break
final_string=s[:i] + s[i:].capitalize()
@krishnachaitanya7
krishnachaitanya7 / word_search_on_select.js
Last active October 10, 2016 06:33
This Gist can be used to search for words selected in a website and search them in your favorite word meaning search engines like dictionary.com specified here. This is a tampermonkey script, in @match specify websites in which you want to search and also allow pop-ups on that website. credits: http://mark.koli.ch/use-javascript-and-jquery-to-ge…
// ==UserScript==
// @name Select_Search
// @namespace http://tampermonkey.net/
// @version 0.1
// @description To Search for a word in your favourite word search engines.
// @author You
// @match https://quizlet.com/*
// @grant GM_setClipboard
// ==/UserScript==
@krishnachaitanya7
krishnachaitanya7 / Sentence_Copy_On_Select.js
Created October 6, 2016 20:52
Copy sentences from a website (website should be specified in @match). just select the sentence and its copied.
// ==UserScript==
// @name Dictionary.com Copy Sentences
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.dictionary.com/*
// @grant GM_setClipboard
// ==/UserScript==
@krishnachaitanya7
krishnachaitanya7 / Enter_text_whenever_pressed_enter.js
Created October 6, 2016 20:55
This script can be modded to add some text whenever a key is pressed. DIY whatever satisfies you, you can change keycodes by replacing "13" and 'keyup' can be replaced by 'keypress' & 'keydown' events whichever satisfies your need
// ==UserScript==
// @name Enter "mnemonic" on pressing enter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://quizlet.com/*
// @grant none
// ==/UserScript==
@krishnachaitanya7
krishnachaitanya7 / quizlet_remove_mnemonics.py
Created December 31, 2016 12:36
It is helpful in making new set of words to learn in quizlet, by removing the mnemonics i have added
import pyperclip,re
final = re.sub(r'^mnemonic.*\n?', '', pyperclip.paste().encode('ascii','replace'), flags=re.MULTILINE)
pyperclip.copy(final)
print "No of words: %d" % len(final.split('\n'))
@krishnachaitanya7
krishnachaitanya7 / wall_command_output_to_clipboard.py
Last active July 22, 2017 18:47
Use this python file to copy the command of wall output to clipboard. The sender needs to login into remote system and send the output he intends the receiver to receive in the wall command. The receiver needs to run this script, please input the credentials of the same server in which the sender has logged in, whenever the script receives the o…
'''
Use this python file to copy the command of wall output to clipboard. The sender needs to login into remote system and send the output he intends the receiver to receive
in the wall command. The receiver needs to run this script, please input the credentials of the same server in which the sender has logged in, whenever the script receives the output it gets copied into clipboard of the PC of the receiver. Would this shit really work?.
'''
from paramiko import SSHClient, AutoAddPolicy
import pyperclip
ssh = SSHClient()
ssh.set_missing_host_key_policy(AutoAddPolicy())
ssh.connect('IP_Adress', username='username', password='password', key_filename='path_to_key')
outdata, errdata = '', ''