Skip to content

Instantly share code, notes, and snippets.

View d4rk8l1tz's full-sized avatar
🎯
Focusing

Kunal Kaul d4rk8l1tz

🎯
Focusing
View GitHub Profile
@d4rk8l1tz
d4rk8l1tz / ssh.expect
Last active August 29, 2015 14:06 — forked from hasanen/ssh.expect
#!/usr/bin/expect -f
set username [lrange $argv 0 0]
set host [lrange $argv 1 1]
set password [lrange $argv 2 2]
set timeout -1
spawn ssh $username@$host
expect "*?assword:*"
send -- "$password\r"
send -- "\r"
@d4rk8l1tz
d4rk8l1tz / convert_csv_to_json
Created July 9, 2015 16:14
Python : Convert CSV to JSON (line by line)
def convertCSVtoJSON(input): #pass the name of the input csv file
f = open(input, 'r')
j = open('.tempJSON', 'w')
fieldnames = ("field1,field2,field3")
reader = csv.DictReader(f, fieldnames)
for row in reader:
json.dump(row, j)
j.write('\n')
f.close()
j.close()