Skip to content

Instantly share code, notes, and snippets.

View uneasyguy's full-sized avatar

Jeff Bingaman uneasyguy

View GitHub Profile
@uneasyguy
uneasyguy / update_time
Created April 9, 2019 02:07
Google Sheets Function to update time
function update_time() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var ss = sheet.getSheetByName('Sheet1');
var formattedDate = Utilities.formatDate(new Date(), "UTC", "MM-dd-yyyy HH:mm:ss");
var merge_range = ss.getRange(3,3,3,3).merge().setHorizontalAlignment("center").setVerticalAlignment("center").setFontWeight("bold").setBorder(true,true,true,true,null,null,"black",SpreadsheetApp.BorderStyle.SOLID_MEDIUM).setFontSize(25);
var input_range = ss.getRange(3,3).setValue(formattedDate);
}
@uneasyguy
uneasyguy / gscript_execution.py
Created April 9, 2019 02:09
script to run google apps scripts via python
from __future__ import print_function
import pickle
import os.path
from googleapiclient import errors
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ['']
credentials_path = ''
from flask import Flask
from flask_restful import Api,Resource
from binance.client import Client
app = Flask(__name__)
api = Api(app)
class Prices(Resource):
def get(self,symbols,something_else):
client = Client(None,None)
import requests
symbols = ['ETHBTC','XRPBTC','BTCUSDT']
something_else = 'hello world'
query_string = str(symbols)+'&'+something_else
url = f'http://127.0.0.1:5000/symbols/{query_string}'
r = requests.get(url)
data = r.json()
print(data)
@uneasyguy
uneasyguy / rc.local
Last active October 25, 2019 23:43
rc.local from youtube video, replace ****USERNAME GOES HERE**** with username from vm instance
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
@uneasyguy
uneasyguy / forever_shell.sh
Created July 18, 2019 20:08
forever_shell from youtube video
#!/bin/sh
/usr/local/bin/forever start -s --minUptime 1000 --spinSleepTime 1000 -c python3 ~/appscript/app.py
@uneasyguy
uneasyguy / rc-local.service
Created July 18, 2019 20:10
rc-local.service from youtube video
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
function myFunction() {
var symbols = ['STRATBTC','OMGBTC','BTCUSDT'];
var something_else = 'hello world';
var query_string = symbols.toString()+'&'+something_else;
var url = 'http://****public ip goes here****:5000/symbols/'+query_string;
var request = UrlFetchApp.fetch(url);
var data = JSON.parse(request.getContentText());
Logger.log(data);
}
@uneasyguy
uneasyguy / app.py
Created July 18, 2019 20:44
Server version of app.py from https://youtu.be/i2qnM_S1vh4
from flask import Flask
from flask_restful import Api,Resource
from binance.client import Client
app = Flask(__name__)
api = Api(app)
class Prices(Resource):
def get(self,symbols,something_else):
client = Client(None,None)
@uneasyguy
uneasyguy / testing.py
Created July 18, 2019 20:45
server version of testing.py from https://youtu.be/i2qnM_S1vh4
import requests
symbols = ['STRATBTC','OMGBTC','BTCUSDT']
something_else = 'hello world'
query_string = str(symbols)+'&'+something_else
url = f'http://****public ip goes here****:5000/symbols/{query_string}'
r = requests.get(url)
data = r.json()
print (data)