I hereby claim:
- I am aasmith on github.
- I am aasmith (https://keybase.io/aasmith) on keybase.
- I have a public key whose fingerprint is 6CDC 81AC 6916 8916 C232 DCCE 6F0B 0A1B D764 A6B5
To claim this, I am signing this object:
| # Before using this script, see output of pmset -g and note the value | |
| # of hibernatemode. | |
| pmset -g | |
| # Save to disk, per pmset(1): | |
| # | |
| # hibernatemode = 25 (binary 0001 1001) is only settable via pmset. The | |
| # system will store a copy of memory to persistent storage (the disk), and | |
| # will remove power to memory. The system will restore from disk image. | |
| sudo pmset -a hibernatemode 25 |
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env ruby -w | |
| # eachdir - Run a command in each child directory. | |
| abort "need command" unless ARGV[0] | |
| abort "quote the command" unless ARGV.size == 1 | |
| def banner(path) | |
| dirname, basename = File.split path | |
| puts |
| # Insert drive. | |
| # See what drives are available. | |
| diskutil list | |
| # Unmount the target drive. | |
| diskutil unmountDisk /dev/disk1 | |
| # OPTIONAL step to convert ISO to usb compatible image (ubuntu ISOs require this) | |
| hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso |
| # encode int i onto n bits | |
| def encode(i, n) | |
| a = [] | |
| i = i.to_i | |
| # Max number that can be stored on initial bits | |
| max = 2**n - 1 | |
| if i < max | |
| a << i |
| def lol(n) | |
| Module.new { define_method(:hoho) { n } } | |
| end | |
| class Bar | |
| extend lol 123 | |
| end | |
| Bar.hoho # => 123 |
| #!/bin/bash | |
| # flac2alac By Arlindo \"Nighto\" Pereira <[email protected]> | |
| # (C) 2010. Licensed on GPLv3" | |
| # modified by jeffrey paul <[email protected]> | |
| # inspiration from http://ca.ubuntuforums.org/member.php?u=6176 (MetalMusicAddict) | |
| # script at http://ca.ubuntuforums.org/showthread.php?t=889700&page=2 |
| # Get the possible max power state and current power states for the device. | |
| # If they all match (i.e. the current state is the same as the max state), | |
| # then the screen is assumed to be on. | |
| power_management = `ioreg -n IODisplayWrangler |grep -i IOPowerManagement` | |
| power_states = power_management.scan(/(?:"\w+PowerState"=(\d))+/) | |
| abort "Not enough power states!" if power_states.size < 2 | |
| screen_on = power_states.uniq.size == 1 |
| # Generate all possible combinations for a 46-point win in the game of | |
| # Goofspiel. | |
| # | |
| cards = [*1..13] | |
| res = [*4..13].map do |n| | |
| cards.combination(n). | |
| select { |cards| cards.reduce(:+) == 46 }. | |
| map(&:sort). | |
| map(&:reverse) |
| # Send all monitors to power saving mode (standby) using the WIN32 API. | |
| # | |
| # Documentation for WM_SYSCOMMAND & SC_MONITORPOWER: | |
| # http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360(v=vs.85).aspx | |
| require 'fiddle' | |
| require 'fiddle/import' | |
| require 'fiddle/types' | |
| module User32 | |
| extend Fiddle::Importer |