This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set-ExecutionPolicy Unrestricted | |
$fromFolderPath = $args[0][0] | |
$toFolderPath = $args[0][1] | |
$toFilename = "" | |
if ($fromFolderPath.Split("\")[-1] -eq "") | |
{ | |
$toFilename = $fromFolderPath.Split("\")[-2] | |
$fromFolderPath = $fromFolderPath.SubString(0, ($fromFolderPath.length-1)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import collections | |
def jumbleSentences(paragraph): | |
sentences = paragraph.split('. ') | |
jumbledSentences = collections.OrderedDict() | |
jumbleCounter = 0 | |
while jumbleCounter < len(sentences): | |
position = random.randrange(0, len(sentences)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import ascii_lowercase | |
ITERATIONS = 3 | |
charMapping = {} | |
charControl = 0 | |
for char in ascii_lowercase: | |
charMapping[charControl] = char | |
charControl+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Saurabh' | |
from PIL import Image | |
IMAGE_NAME = 'RandomText.gif' | |
inputImage = Image.open(IMAGE_NAME) | |
inputImageMatrix = inputImage.load() | |
BLACK = 0 | |
WHITE = 255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#replace th0 with interface name and the 1st ip with nic ip and 2nd ip with proxy ip | |
ip="$(ifconfig eth0|grep 'inet addr'|awk -F':' '{print $2}'| awk -F' ' '{print $1}')" | |
if [[ $ip = "172.24.0.2" ]] | |
then | |
export http_proxy="http://172.24.0.1:3128" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeat=10 | |
while [ $x -gt 0 ] | |
do | |
python "C:\\Python27\\lib\\timeit.py" -n 3 "f = open('file.txt', 'wb+'); f.write('chunk'); f.close()" >> results.txt | |
repeat=$((repeat-1)) | |
done | |
data="$(awk '{print $6}' results.txt)" | |
echo $data | |
python -c "results = map(float, \"\"\"$data\"\"\".split('\n')); from matplotlib import pyplot; pyplot.plot(range(1,11), results); pyplot.savefig('results.png')" | |
rm results.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import javax.imageio.*; | |
import java.awt.image.*; | |
import java.util.*; | |
import java.awt.Color; | |
class Operator | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do set gateway=%%~a | |
IF %gateway%==192.168.1.1 ( | |
netsh interface ip set address name="Wi-Fi" static 192.168.1.10 255.255.255.0 192.168.1.41 1 | |
) ELSE ( | |
netsh interface ip set address name="Wi-Fi" static 192.168.1.10 255.255.255.0 192.168.1.1 1 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
auth = tweepy.auth.OAuthHandler( | |
consumer_key="key", | |
consumer_secret="secret") | |
auth.set_access_token( | |
'token', | |
'secret') | |
api=tweepy.API(auth_handler=auth) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#You'll still have to manually enter dates here, as the xlsx file from zerodha does not show dates(SIP of stocks causes multiple dates) | |
#EDIT: Usage python zerodha_to_moneycontrol.py <FILENAME> | |
import sys | |
from openpyxl import load_workbook | |
wb = load_workbook(sys.argv[1]) | |
ws = wb.active | |
csv_list = [["BSE/NSE/ISIN Code","Buy Date","Buy Quantity","Buy Price",]] |
OlderNewer