Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mahnve's full-sized avatar

Marcus Ahnve mahnve

View GitHub Profile
### 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:
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]),
https://api.login.yahoo.com/oauth2/request_auth?redirect_uri=http%3A%2F%2Flocal.funnel.io%2Fauthv4.html%3Fsource_type%3Dyahoo%26callback%3Dtrue&response_type=code&client_id=<client_id>
@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)'
@mahnve
mahnve / late_print.ex
Last active August 29, 2015 14:16
Starts a few processes, who waits a randomly long time before calling back.
defmodule LatePrint do
def late_print(0) do
handle_message
end
def late_print(n) do
parent = self
spawn_link(fn ->
@mahnve
mahnve / gist:927fa44a4b22f34d3bf0
Created February 12, 2015 14:19
Find unused js libraries
for file in $(find . -iname "*.js" | sed 's/\.\///g' ); do grep -q $file ../*/*.html; if [ $? -ne 0 ]; then echo $file; fi; done
@mahnve
mahnve / gist:ec3e8d7494cd2c4a059c
Last active August 29, 2015 14:14
Count number of copies of NPM libs
find . -iname node_modules | xargs -I{} find {} -maxdepth 1 -type d | xargs -I{} basename {} | grep -v 'node_modules\|.bin' | sort | uniq -c | sort -rn
@mahnve
mahnve / gist:e50f07b21b413aaaacc3
Created June 11, 2014 22:00
logstash.aws.json
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "pblittle/docker-logstash",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "9292"
},
input {
stdin {
type => "stdin-type"
}
file {
type => "syslog"
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
start_position => "beginning"
}

Keybase proof

I hereby claim:

  • I am mahnve on github.
  • I am mahnve (https://keybase.io/mahnve) on keybase.
  • I have a public key whose fingerprint is 4ABA 33B1 3539 B480 81E0 6D86 1DAE 133E 4848 618C

To claim this, I am signing this object: