Skip to content

Instantly share code, notes, and snippets.

View mahnve's full-sized avatar

Marcus Ahnve mahnve

View GitHub Profile
@mahnve
mahnve / gist:a173857078ecf5849dce
Last active August 30, 2022 21:47
get list of AWS us east ip ranges
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes' | jq 'map(select(.region=="us-east-1"))' | jq 'map(.ip_prefix)'
### Keybase proof
I hereby claim:
* I am mahnve on github.
* I am mahnve (https://keybase.io/mahnve) on keybase.
* I have a public key ASApVvHP9fVZoatxYRT_nN89OtOu-ozxDtzWhXSFEVfU5Qo
To claim this, I am signing this object:
@mahnve
mahnve / add_todo.sh
Created April 9, 2011 14:41
Pop up a zenity input dialog box for adding to todo.txt
zenity --entry --width=500 --text=Todo: | xargs todo.sh add
@mahnve
mahnve / list_todos.sh
Created April 9, 2011 14:39
List all todo's from todo.txt in a zenity list with checkboxes to mark as done
#!/bin/sh
todo.sh -p list | sed -r '/(TODO|--).*/d' | sed -r 's/([0-9]+)\s(.*)/\1\ \1\ "\2"/g' | xargs zenity --width 800 --height 600 --list --text=Todo --checklist --column=Done --column=number --column=Task --multiple | sed -r 's/\|/,/g' | xargs todo.sh do
class Arithmetic {
public double calculateInterest(int initialAmount, double interest, int years) {
double cumulativeInterest = Math.pow((1 + interest), years);
return cumulativeInterest * initialAmount;
}
public static void main(String args[]) {
Arithmetic arithmetic = new Arithmetic();
double sum = arithmetic.calculateInterest(Integer.parseInt(args[0]),
@mahnve
mahnve / watchr script
Created May 9, 2011 07:43 — forked from markbates/watchr script
A Watchr script for rails, rspec, and cucumber
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
puts message
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
@mahnve
mahnve / tag_release.sh
Created February 10, 2011 14:37
Script for tagging a release in svn
#!/bin/bash.sh (press RETURN)
cd ~/svn-trunk
# Get the SVN commit message from the git log
COMMIT_MESSAGE=`git log -1 --format=oneline`
RELEASE_TAG=`date +%Y_%m_%d_%k_%M`
echo $RELEASE_TAG
RELEASE_URL="https://intrawww.x.ngm.se/ngnews-svn/tags/REL_"$RELEASE_TAG
@mahnve
mahnve / dump_to_svn.sh
Created February 9, 2011 12:47
A script to dump a git repo to svn.
#!/bin/bash
cd ~/svn-trunk
# Update from git
git pull
# Add files that need to be added to svn
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
#!/bin/zsh
mpc play
sleep 1500
zenity --info --text "Pomodoro paus" &
mpc pause
mplayer ~/music/sounds/ting.mp3
plugin 'make_resourceful', :git => 'git://github.com/hcatlin/make_resourceful.git'
gem 'paperclip'
gem 'haml'
gem 'shoulda'
gem 'factory_girl'
gem 'cucumber'
############## commands #################