Skip to content

Instantly share code, notes, and snippets.

@bennyyip
Last active December 10, 2018 06:50
Show Gist options
  • Select an option

  • Save bennyyip/25b8b92cae7629ed135f8aff8d4cf1df to your computer and use it in GitHub Desktop.

Select an option

Save bennyyip/25b8b92cae7629ed135f8aff8d4cf1df to your computer and use it in GitHub Desktop.
fasd_to_z
#!/usr/bin/env python
import os
fasd = os.path.expandvars('$HOME/.fasd')
z = os.path.expandvars('$HOME/.z')
with open(fasd) as in_f, open(z, 'w') as out_f:
for line in in_f:
x = line.split('|')
if not os.path.isdir(x[0]):
continue
x[1] = str(int(float(x[1])))
print(x)
out_f.write('|'.join(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment