Skip to content

Instantly share code, notes, and snippets.

from flask import Flask
from flask import request
app = Flask(__name__)
@app.route("/purchase", methods = ["POST", "GET"])
def purchase():
if request.method == "POST":
name = request.form["item_name"]
tx = request.form["tx"]
@ewancook
ewancook / callbacks.go
Last active August 29, 2015 14:14
Beginnings of a Steam Trade Bot
// callbacks.go
package main
import (
"fmt"
"github.com/Philipp15b/go-steam"
"github.com/Philipp15b/go-steam/internal/steamlang"
"io/ioutil"
"time"
)
@ewancook
ewancook / price_tracker.py
Created March 4, 2015 20:53
a python script to track the price of a single cryptocurrency using Cryptsy's API.
from twisted.words.protocols import irc
from twisted.words.protocols.irc import assembleFormattedText as aFT, attributes as A
from twisted.internet import defer, reactor, protocol, task
import requests as r
class bot(irc.IRCClient):
last_price = 0
@property
def market_label(self):
@ewancook
ewancook / bump.py
Last active March 2, 2017 19:46
A short autobumping script for tf2outpost.com
import threading
import time
import random
from datetime import datetime
import requests
# The user hash can be found by viewing the source of any tf2outpost.com page whilst logged in.
# It will change upon logging in or out.
package main
import (
"io"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello, World!")
}
@ewancook
ewancook / key_bank.js
Created October 26, 2015 13:12
Key Bank Bot (old)
var Steam = require("steam");
var SteamTrade = require("steam-trade");
var _ = require("underscore");
var steam = new Steam.SteamClient();
var steamTrade = new SteamTrade();
var config = require("./config.js");
var adminID = config.adminID
var username = config.username;
var password = config.password;
var finished = false
@ewancook
ewancook / kraken.py
Last active September 2, 2018 19:49
basic implementation of maths for cryptocurrency arbitrage
#!/usr/bin/env python
from collections import OrderedDict, namedtuple
from datetime import datetime
from threading import Timer
import requests
fee_factor = 0.9974
currencies = OrderedDict(
[("LTCUSD", "XLTCZUSD"), ("LTCXBT", "XLTCXXBT"), ("XBTUSD", "XXBTZUSD")])
@ewancook
ewancook / qleach.go
Last active March 2, 2017 17:01
A short program that determines the number of leachers needed for the given variables
package main
import (
"flag"
"fmt"
"math"
)
func main() {
feed := flag.Float64("feed", 1, "the feed flowrate")
@ewancook
ewancook / arb.go
Last active June 10, 2019 19:00
triangular arbitrage profitability calculator (poloniex)
package main
import (
"encoding/json"
"flag"
"fmt"
"math"
"net/http"
"strconv"
"time"
@ewancook
ewancook / blanks.vba
Last active February 9, 2018 18:54
Sets mole fractions to 0 for blank cells without a specific number formatting (based on a guessed correlation)
Sub blanks()
Application.ScreenUpdating = False
Set xr = Worksheets("Sheet1")
For colNum = 1 To 19 Step 2
For Each c In xr.Range(xr.Cells(9, colNum), xr.Cells(56, colNum))
If IsEmpty(c) And c.Interior.ColorIndex = xlNone And c.Font.Bold = False Then
If c.NumberFormat <> "0.000" And c.Row <> 19 And c.Row <> 20 And c.Row <> 38 And c.Row <> 39 Then
c.Value = "0"
End If
End If