From 2879815374be27131f09268359e3d0a882e95b51 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 12 Oct 2013 15:13:24 -0700 Subject: [PATCH] add new scripts: git-conflicts and occupy-ram --- git-conflicts | 4 ++++ occupy-ram | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 git-conflicts create mode 100755 occupy-ram diff --git a/git-conflicts b/git-conflicts new file mode 100755 index 0000000..9f2d907 --- /dev/null +++ b/git-conflicts @@ -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 diff --git a/occupy-ram b/occupy-ram new file mode 100755 index 0000000..a04f69c --- /dev/null +++ b/occupy-ram @@ -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