Skip to content
Browse files

clean up misc/ a bit

  • Loading branch information...
1 parent 0d50400 commit b9ca39d7104c34bdc5dcedf6e95e702f1c3d8d2e @grawity committed Nov 19, 2013
View
1 bin/maildir-layout
View
0 misc/libident-php/in.whoami → lib/php/libident/in.whoami
File renamed without changes.
View
0 misc/libident-php/libident.php → lib/php/libident/libident.php
File renamed without changes.
View
0 misc/libident-php/whoami.php → lib/php/libident/whoami.php
File renamed without changes.
View
0 misc/maildir-layout → mail/maildir-layout
File renamed without changes.
View
165 misc/getkeyring
@@ -1,165 +0,0 @@
-#!/usr/bin/env python2
-import os, sys
-
-import getopt
-import gnomekeyring as gkr
-
-# Supported format characters:
-# %k one-letter key from data[]
-# %{key} string key from data[]
-# \0 \n \r \t standard C string escapes
-# \xHH \uHHHH standard hex and Unicode escapes
-# ${key} environment variable
-#
-# Only ${key} is allowed; $key is not.
-# Backslash escapes or nested formats are not supported.
-def format(pattern, data):
- output = ""
- key = ""
- state = 0
- for char in pattern:
- #print "state %d char '%s' key '%s'" % (state,char,key)
- if state == 0:
- key = ""
- if char == "%":
- state = 1
- elif char == "\\":
- state = 2
- elif char == "$":
- state = 6
- else:
- output += char
- elif state == 1:
- state = 0
- if char == "{":
- state = 3
- elif char == "%":
- output += char
- elif char in data:
- output += data[char]
- else:
- print >> sys.stderr, "format: unknown key '%s'" % char
- elif state == 2:
- if char == "x":
- state = 4
- if char == "u":
- state = 5
- else:
- output += {
- '0': "\0",
- 'n': "\n",
- 'r': "\r",
- 't': "\t",
- }.get(char, char)
- state = 0
- elif state == 3:
- if char == "}":
- if key in data:
- output += data[key]
- else:
- print >> sys.stderr, "format: unknown key '%s'" % key
- state = 0
- else:
- key += char
- elif state in (4, 5):
- if char in '0123456789ABCDEFabcdef':
- key += char
- if state == 4 and len(key) == 2:
- output += chr(int(key, 16))
- state = 0
- elif state == 5 and len(key) == 4:
- output += unichr(int(key, 16))
- state = 0
- else:
- print >> sys.stderr, "format: invalid hex character '%s'" % char
- state = 0
- elif state == 6:
- if char == "{":
- state = 7
- else:
- print >> sys.stderr, "format: environ specifier must be ${key}"
- state = 0
- elif state == 7:
- if char == "}":
- if key in os.environ:
- output += os.environ[key]
- else:
- print >> sys.stderr, "format: unknown environ '%s'" % key
- state = 0
- else:
- key += char
- return output
-
-def usage():
- print >> sys.stderr, "Usage: getkeyring [-k keyring] action [options]"
- print >> sys.stderr, """
-Actions:
- list [-f format]
- get [-f format] <id>
-"""
- sys.exit(2)
-
-def is_keyring_locked():
-# return False
- info = gkr.get_info_sync(keyring)
- return info.get_is_locked()
-
-def list_items(attrs=True):
- for id in sorted(gkr.list_item_ids_sync(keyring)):
- show_item(id, attrs)
-
-def show_item(id, attrs=True):
- try:
- info = gkr.item_get_info_sync(keyring, id)
- data = gkr.item_get_attributes_sync(keyring, id)
- except gkr.BadArgumentsError:
- print >> sys.stderr, "getkeyring: Invalid arguments"
- return False
-
- if pretty:
- print "%d: %s" % (id, info.get_display_name())
- if attrs:
- for key in sorted(data.keys()):
- print "\t%s: %s" % (key, data[key])
- else:
- data["n"] = data["Name"] = info.get_display_name()
- data["s"] = data["Secret"] = info.get_secret()
- print format(format_pattern, data)
-
-if not gkr.is_available():
- print >> sys.stderr, "getkeyring: Keyring service not available"
- sys.exit(1)
-
-keyring = gkr.get_default_keyring_sync()
-
-pretty = True
-format_pattern = None
-
-opts, rest = getopt.gnu_getopt(sys.argv[1:], "f:k:")
-for opt, value in opts:
- if opt == "-f":
- pretty = False
- format_pattern = value
- elif opt == "-k":
- keyring = value
-
-try:
- command = rest.pop(0)
-except IndexError:
- usage()
-
-if is_keyring_locked():
- print >> sys.stderr, "getkeyring: keyring is locked"
- sys.exit(1)
-
-if command == "list":
- list_items(False)
-elif command == "get":
- if len(rest):
- for id in rest:
- show_item(int(id), True)
- else:
- list_items(True)
-else:
- print >> sys.stderr, "getkeyring: Unknown command '%s'" % command
- sys.exit(2)
View
1 misc/libident-php
View
0 misc/id3-lyrics.py → music/id3-lyrics.old
File renamed without changes.
View
0 misc/irc → net/irc
File renamed without changes.
View
0 misc/obml-parser → net/obml-parser
File renamed without changes.
View
0 misc/pkey-sexp.pl → security/lsh-import-key
File renamed without changes.

0 comments on commit b9ca39d

Please sign in to comment.
Something went wrong with that request. Please try again.