This commit is contained in:
Tobias Kessels
2017-08-15 08:11:45 +02:00
3 changed files with 60 additions and 2 deletions

View File

@@ -1,2 +1,10 @@
# gists # gists
uploadtest
##chechsqlite.py
test sqliteDBs for consistency and passwords
##sort.py
move/sort files in current dir to subfolder named after mime-type
##toggle_touchpad
toggle touchpad on notebook on and off via xinput

50
json_save.py Normal file
View File

@@ -0,0 +1,50 @@
import simplejson
import json
def put(data, filename):
try:
jsondata = simplejson.dumps(data, indent=4, skipkeys=True, sort_keys=True)
fd = open(filename, 'w')
fd.write(jsondata)
fd.close()
except Exception as e:
print('ERROR writing', filename)
print( e)
pass
def get(filename):
returndata = {}
try:
fd = open(filename, 'r')
text = fd.read()
fd.close()
returndata = json.read(text)
# Hm. this returns unicode keys...
#returndata = simplejson.loads(text)
except:
print('COULD NOT LOAD:', filename)
return returndata
# print(mail.filename)
# print(mail.status)
# import gzip
# import json
#
# # writing
# with gzip.GzipFile(jsonfilename, 'w') as outfile:
# for obj in objects:
# outfile.write(json.dumps(obj) + '\n')
#
# # reading
# with gzip.GzipFile(jsonfilename, 'r') as isfile:
# for line in infile:
# obj = json.loads(line)
# # process obj
# picklefile=open("mails.dump",'wb')
# for mail in list_of_mail:
# pickle.dump(mail, picklefile )
#
# picklefile.close()

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
touchpad_id=$(xinput list | grep -i touch | grep -Po '(?<=id=)\d+') touchpad_id=$(xinput list | grep -i touch | grep -Po '(?<=id=)\d+')
if (xinput list-props 14 | grep "Device Enabled" | grep -Po '\d$' | grep -q "1"); then if (xinput list-props ${touchpad_id} | grep "Device Enabled" | grep -Po '\d$' | grep -q "1"); then
xinput disable "${touchpad_id}" xinput disable "${touchpad_id}"
else else
xinput enable "${touchpad_id}" xinput enable "${touchpad_id}"