add new scripts: git-conflicts and occupy-ram

This commit is contained in:
Sami Samhuri 2013-10-12 15:13:24 -07:00
parent 4100928b4a
commit 2879815374
2 changed files with 23 additions and 0 deletions

4
git-conflicts Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
# Usage: git-conflicts
# Show list of files in a conflict state.
git ls-files -u | awk '{print $4}' | sort -u

19
occupy-ram Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env ruby
def free_pages
`vm_stat`.split(/\n/).grep(/free/).first.scan(/\d+/).first.to_i
end
mega = 1024 * 1024.0
a = []
n = 0
free = free_pages
until free < 100_000
a << '-' * (100 * mega)
n += 100
free = free_pages
puts "Occupied #{n} MB, #{(4096 * free / mega).round(2)} MB still free"
end
puts 'full, looping forever...'
a.each { |s| s =~ /foo/ } while true