tnew stuff - scripts - random scripts
HTML git clone git://parazyd.org/scripts.git
DIR Log
DIR Files
DIR Refs
---
DIR commit 24c4f622a4f5311abcc5c76c234173be8d56b680
DIR parent 860f0a8df966820bb28a8cd9289638dbe0aabba3
HTML Author: parazyd <parazyd@dyne.org>
Date: Fri, 1 Sep 2017 10:59:25 +0200
new stuff
Diffstat:
T elem | 0
R obsolete/addrepo.sh -> notinpath/o… | 0
R obsolete/auphone -> notinpath/obso… | 0
R obsolete/beepop -> notinpath/obsol… | 0
R obsolete/blink.sh -> notinpath/obs… | 0
R obsolete/bright -> notinpath/obsol… | 0
R obsolete/catfact.py -> notinpath/o… | 0
R obsolete/disco -> notinpath/obsole… | 0
R obsolete/dmenu.sh -> notinpath/obs… | 0
R obsolete/img -> notinpath/obsolete… | 0
R obsolete/ix -> notinpath/obsolete/… | 0
R obsolete/lock -> notinpath/obsolet… | 0
R obsolete/mycosmos -> notinpath/obs… | 0
R obsolete/pio -> notinpath/obsolete… | 0
A notinpath/obsolete/popup | 2 ++
R obsolete/powertoptune.sh -> notinp… | 0
R obsolete/rotmon -> notinpath/obsol… | 0
R obsolete/scream.sh -> notinpath/ob… | 0
R obsolete/signrelease -> notinpath/… | 0
R obsolete/spin -> notinpath/obsolet… | 0
R obsolete/startcups.sh -> notinpath… | 0
R obsolete/startdwm -> notinpath/obs… | 0
R obsolete/startvbox.sh -> notinpath… | 0
R obsolete/surf.sh -> notinpath/obso… | 0
R obsolete/torrentnotif.sh -> notinp… | 0
R obsolete/translate -> notinpath/ob… | 0
R obsolete/updatepw.sh -> notinpath/… | 0
R obsolete/weepop.sh -> notinpath/ob… | 0
R obsolete/xkcd -> notinpath/obsolet… | 0
R obsolete/xkcd.py -> notinpath/obso… | 0
R obsolete/ydl -> notinpath/obsolete… | 0
R obsolete/ys -> notinpath/obsolete/… | 0
R obsolete/yt -> notinpath/obsolete/… | 0
D obsolete/popup | 2 --
M p | 2 ++
M radio | 6 ++++--
M wd | 4 ++--
M wifi | 2 +-
M xkcd | 18 ++++++------------
A xlstojson.py | 68 +++++++++++++++++++++++++++++++
40 files changed, 85 insertions(+), 19 deletions(-)
---
DIR diff --git a/elem b/elem
DIR diff --git a/obsolete/addrepo.sh b/notinpath/obsolete/addrepo.sh
DIR diff --git a/obsolete/auphone b/notinpath/obsolete/auphone
DIR diff --git a/obsolete/beepop b/notinpath/obsolete/beepop
DIR diff --git a/obsolete/blink.sh b/notinpath/obsolete/blink.sh
DIR diff --git a/obsolete/bright b/notinpath/obsolete/bright
DIR diff --git a/obsolete/catfact.py b/notinpath/obsolete/catfact.py
DIR diff --git a/obsolete/disco b/notinpath/obsolete/disco
DIR diff --git a/obsolete/dmenu.sh b/notinpath/obsolete/dmenu.sh
DIR diff --git a/obsolete/img b/notinpath/obsolete/img
DIR diff --git a/obsolete/ix b/notinpath/obsolete/ix
DIR diff --git a/obsolete/lock b/notinpath/obsolete/lock
DIR diff --git a/obsolete/mycosmos b/notinpath/obsolete/mycosmos
DIR diff --git a/obsolete/pio b/notinpath/obsolete/pio
DIR diff --git a/notinpath/obsolete/popup b/notinpath/obsolete/popup
t@@ -0,0 +1 @@
+beepop
+\ No newline at end of file
DIR diff --git a/obsolete/powertoptune.sh b/notinpath/obsolete/powertoptune.sh
DIR diff --git a/obsolete/rotmon b/notinpath/obsolete/rotmon
DIR diff --git a/obsolete/scream.sh b/notinpath/obsolete/scream.sh
DIR diff --git a/obsolete/signrelease b/notinpath/obsolete/signrelease
DIR diff --git a/obsolete/spin b/notinpath/obsolete/spin
DIR diff --git a/obsolete/startcups.sh b/notinpath/obsolete/startcups.sh
DIR diff --git a/obsolete/startdwm b/notinpath/obsolete/startdwm
DIR diff --git a/obsolete/startvbox.sh b/notinpath/obsolete/startvbox.sh
DIR diff --git a/obsolete/surf.sh b/notinpath/obsolete/surf.sh
DIR diff --git a/obsolete/torrentnotif.sh b/notinpath/obsolete/torrentnotif.sh
DIR diff --git a/obsolete/translate b/notinpath/obsolete/translate
DIR diff --git a/obsolete/updatepw.sh b/notinpath/obsolete/updatepw.sh
DIR diff --git a/obsolete/weepop.sh b/notinpath/obsolete/weepop.sh
DIR diff --git a/obsolete/xkcd b/notinpath/obsolete/xkcd
DIR diff --git a/obsolete/xkcd.py b/notinpath/obsolete/xkcd.py
DIR diff --git a/obsolete/ydl b/notinpath/obsolete/ydl
DIR diff --git a/obsolete/ys b/notinpath/obsolete/ys
DIR diff --git a/obsolete/yt b/notinpath/obsolete/yt
DIR diff --git a/obsolete/popup b/obsolete/popup
t@@ -1 +0,0 @@
-beepop
-\ No newline at end of file
DIR diff --git a/p b/p
t@@ -2,3 +2,5 @@
ff=/usr/bin/firefox
exec $ff -no-remote -ProfileManager
+
+#sudo -u ff firefox -no-remote -ProfileManager
DIR diff --git a/radio b/radio
t@@ -13,6 +13,7 @@ list of radios:
6. YAMMAT
7. KLFM
8. NOPE
+ 9. Radio Paradise
EOM
exit 1
}
t@@ -27,9 +28,10 @@ case "$1" in
3|blurfm) play "http://radio.dyne.org/blurfm02.m3u" ;;
4|auroville) play "http://radio.dyne.org/auroville.mp3.m3u" ;;
5|2f30) play "http://radio.2f30.org:8000/live.mp3" ;;
- 6|yammat) play "http://192.240.102.131:9107" ;;
- 7|klfm) play "http://klfm.streamradio.com.hr:5000/listen.pls" ;;
+ 6|yammat) play "http://192.240.102.133:12430/" ;;
+ 7|klfm) play "http://klfm.streamradio.com.hr:2199/tunein/klfm1.pls" ;;
8|nope) play "http://radionope.streamguys1.com/listen.pls" ;;
+ 9|paradise) play "http://stream-eu1.radioparadise.com:80/mp3-128" ;;
*) usage ;;
esac
DIR diff --git a/wd b/wd
t@@ -1,3 +1,3 @@
#!/bin/sh
-
-exec surf http://rpi/wd
+exec surf http://rpi/$(basename $0)
+#exec surf http://rpi:8000/$(basename $0)
DIR diff --git a/wifi b/wifi
t@@ -1,6 +1,6 @@
#!/bin/sh
-dev=wlan0
+dev=${dev:=wlan0}
wpasup=/etc/wpa_supplicant/wpa_supplicant.conf
usage() {
DIR diff --git a/xkcd b/xkcd
t@@ -39,11 +39,8 @@ def add_text(image, title, alt, tfont=download_dir+'xkcd.ttf',
draw = ImageDraw.Draw(img)
lheight_total = line_padding
for i in lines:
- draw.text((w/2-tfont.getsize(" ".join(i))[0]/2,
- lheight_total),
- " ".join(i),
- font=tfont,
- fill=0xffffff)
+ draw.text((w/2-tfont.getsize(" ".join(i))[0]/2, lheight_total),
+ " ".join(i), font=tfont, fill=0xffffff)
lheight_total += lheight + line_padding
lheight_total = line_padding
lines = text_wrap(afont, alt, w)
t@@ -57,11 +54,8 @@ def add_text(image, title, alt, tfont=download_dir+'xkcd.ttf',
for i in lines:
if not i:
continue
- draw.text((w/2-afont.getsize(" ".join(i))[0]/2,
- lheight_total),
- " ".join(i),
- font=afont,
- fill=0xffffff)
+ draw.text((w/2-afont.getsize(" ".join(i))[0]/2, lheight_total),
+ " ".join(i), font=afont, fill=0xffffff)
lheight_total += lheight + line_padding
img.save(image)
t@@ -108,8 +102,8 @@ def main():
info = get("https://xkcd.com/"+str(randrange(1, info['num']) + 1)+"/info.0.json").json()
title = info['safe_title']
- alt = info['alt']
- num = str(info['num'])
+ alt = info['alt']
+ num = str(info['num'])
image = num+search("\.([a-z])+$", info['img']).group()
DIR diff --git a/xlstojson.py b/xlstojson.py
t@@ -0,0 +1,68 @@
+#!/usr/bin/env python3
+import xlrd
+import json
+import os.path
+import sys
+
+def getColNames(sheet):
+ rowSize = sheet.row_len(0)
+ colValues = sheet.row_values(0, 0, rowSize )
+ columnNames = []
+
+ for value in colValues:
+ columnNames.append(value)
+
+ return columnNames
+
+def getRowData(row, columnNames):
+ rowData = {}
+ counter = 0
+
+ for cell in row:
+ rowData[columnNames[counter]] = cell.value
+ counter +=1
+
+ return rowData
+
+def getSheetData(sheet, columnNames):
+ nRows = sheet.nrows
+ sheetData = []
+ counter = 1
+
+ for idx in range(1, nRows):
+ row = sheet.row(idx)
+ rowData = getRowData(row, columnNames)
+ sheetData.append(rowData)
+
+ return sheetData
+
+def getWorkBookData(workbook):
+ nsheets = workbook.nsheets
+ counter = 0
+ workbookdata = {}
+
+ for idx in range(0, nsheets):
+ worksheet = workbook.sheet_by_index(idx)
+ columnNames = getColNames(worksheet)
+ sheetdata = getSheetData(worksheet, columnNames)
+ workbookdata[worksheet.name] = sheetdata
+
+ return workbookdata
+
+def main():
+ filename = sys.argv[1]
+
+ if os.path.isfile(filename):
+ workbook = xlrd.open_workbook(filename, encoding_override="cp1252")
+ workbookdata = getWorkBookData(workbook)
+ output = \
+ open((filename.replace("xlsx", "json")).replace("xls", "json"), "w")
+ output.write(json.dumps(workbookdata, sort_keys=True, indent=4, separators=(',', ": ")))
+ output.close()
+ print("%s was created" % output.name)
+ else:
+ print("Sorry, that was not a valid filename")
+
+
+
+main()