Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 61aa40d
Showing
9 changed files
with
1,494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
|
||
# gem "rails" | ||
|
||
gem "amex", "~> 0.4.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
amex (0.4.1) | ||
httparty | ||
nokogiri | ||
httparty (0.17.0) | ||
mime-types (~> 3.0) | ||
multi_xml (>= 0.5.2) | ||
mime-types (3.2.2) | ||
mime-types-data (~> 3.2015) | ||
mime-types-data (3.2019.0331) | ||
mini_portile2 (2.4.0) | ||
multi_xml (0.6.0) | ||
nokogiri (1.10.3) | ||
mini_portile2 (~> 2.4.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
amex (~> 0.4.1) | ||
|
||
BUNDLED WITH | ||
2.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env ruby | ||
require 'amex' | ||
|
||
class Expronzo | ||
attr_reader :client | ||
|
||
unless ENV['amexu'] and ENV['amexp'] | ||
raise "ur amex username and password must be available in" + | ||
"the environmental variables 'amexu' and 'amexp'." | ||
end | ||
|
||
def initialize | ||
@accounts = Amex::Client. | ||
new(ENV['amexu'], ENV['amexp']) | ||
.accounts | ||
|
||
@accounts.each do |account| | ||
puts account.transactions.inspect | ||
end | ||
end | ||
end | ||
|
||
Expronzo.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
pot_id=pot_00009idHc715Uf9KcBiUMb | ||
access_token=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlYiI6IkpiMnhrdzVWNUh0WE1XMUd4bCtRIiwianRpIjoiYWNjdG9rXzAwMDA5akl2Z0RabjBjdERMOWtCeUciLCJ0eXAiOiJhdCIsInYiOiI1In0.3tZ2velWEi714dr5P2eleGG5BM6gMiCCjCyae4gg977KcBOcD1Y2F-YdjqocsKOOSHLEK2clMmI-eMstkCOEvg | ||
account_id=acc_00009OeBcb40RrGoHJQAwD | ||
dedupe_id=$RANDOM-lol | ||
current_pot_value=$(http "https://api.monzo.com/pots" "Authorization: Bearer $access_token" | jq ".pots[] | select(.id==\"$pot_id\") | .balance") | ||
echo "there's currently $current_pot_value in the amex pot" | ||
current_balance=$(($(node index.js) * 100)) | ||
echo "the amex balance is $current_balance" | ||
increase=$((current_balance - current_pot_value)) | ||
echo "that's an increase of $increase pennies" | ||
|
||
if [ $increase -lt 1 ]; then | ||
echo "that's less than a penny, so im doin nothin" | ||
exit | ||
fi | ||
|
||
http --form PUT "https://api.monzo.com/pots/$pot_id/deposit" \ | ||
"Authorization: Bearer $access_token" \ | ||
"source_account_id=$account_id" \ | ||
"amount=$increase" \ | ||
"dedupe_id=$dedupe_id" | ||
|
||
echo "transaction complete!!" | ||
current_pot_value=$(http "https://api.monzo.com/pots" "Authorization: Bearer $access_token" | jq ".pots[] | select(.id==\"$pot_id\") | .balance") | ||
echo "there's now $current_pot_value in the pot ^_^" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
let pup = require("puppeteer") | ||
|
||
void (async function() { | ||
let puppy = await pup.launch({ headless: false }) | ||
let bone = await puppy.newPage() | ||
await bone.goto( | ||
"https://global.americanexpress.com/login/en-GB?noRedirect=true&DestPage=%2Fdashboard" | ||
) | ||
await bone.waitForSelector(".eliloUserId input") | ||
await bone.type(".eliloUserId input", "snootgirl22") | ||
await bone.waitForSelector(".eliloPassword input") | ||
await bone.type(".eliloPassword input", "magicfriend22") | ||
await bone.click("[type=submit]") | ||
await bone.waitForSelector(".summary-container") | ||
await bone.waitForSelector( | ||
"ul .undefined:nth-child(1) .value-link-inline-block" | ||
) | ||
|
||
let balanceElement = await bone.$( | ||
"ul .undefined:nth-child(1) .value-link-inline-block .data-value" | ||
) | ||
|
||
let availableBalance = await bone.evaluate( | ||
element => element.textContent, | ||
balanceElement | ||
) | ||
|
||
let availableCredit = 3000 | ||
|
||
let currentBalance = | ||
availableCredit - parseFloat(availableBalance.replace(/[^.0-9]/g, "")) | ||
|
||
console.log(currentBalance) | ||
|
||
await puppy.close() | ||
})() |
Oops, something went wrong.