Skip to content

Instantly share code, notes, and snippets.

@ybur-yug
Last active August 29, 2015 14:17
Show Gist options
  • Save ybur-yug/299c0b379a6c361f1b0c to your computer and use it in GitHub Desktop.
Save ybur-yug/299c0b379a6c361f1b0c to your computer and use it in GitHub Desktop.
require 'fileutils'
include FileUtils
# U G O
# rwxrwxrwx
0b111101101
perms = 0b111101101
perms.to_s(8)
#=> 755
chmod perms 'somefile'
# and now youre absolutely sure on permissions without extra thought
# Or if you get back random perms and want to check them easily:
0755.to_s(2)
#=> "111101101"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment