Skip to content

Instantly share code, notes, and snippets.

View jeffdeville's full-sized avatar

Jeff Deville jeffdeville

View GitHub Profile
@jeffdeville
jeffdeville / run_alpaca_proxy.sh
Created September 3, 2023 14:45
How to run the alpaca_proxy
#!/bin/bash
git clone https://github.com/withbelay/alpaca-proxy
cd alpaca-proxy
docker build -t alpaca-proxy .
docker run -e ALPACA_BASE_URL=https://broker-api.sandbox.alpaca.markets \
-e ALPACA_KEY=YOUR_ALPACA_KEY \
-e ALPACA_SECRET=YOUR_ALPACA_SECRET \
-e BELAY_SECRET=secret \
-e SECRET_KEY_BASE=any_random_string \
from belay.client import PolicyClient
from belay.requests import PolicyPurchaseRequest
from belay.enums import Durations
policy_client = PolicyClient('client_id', 'client_secret', sandbox=True)
policy_client.purchase(
PolicyPurchaseRequest(
sym="AAPL",
qty=5,
async createPayment({
neatAccountId,
paymentToken,
amount,
paymentId,
rbit,
cardHolder,
providerSettings,
}: CreditCardPaymentRequest): Promise<WePayPayment> {
this.validateRbit(rbit)
### Keybase proof
I hereby claim:
* I am jeffdeville on github.
* I am jeffdeville (https://keybase.io/jeffdeville) on keybase.
* I have a public key ASDWgkKEASzvtUQnTN8oBZBhCEoe87V8lU9vsKY87mUE3wo
To claim this, I am signing this object:
@jeffdeville
jeffdeville / doctors.csv
Created June 28, 2016 13:12
Sample doctors csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
post_latitude,post_longitude,MatchType,NumMatch,MatchScore,post_category,post_type,post_status,post_title,post_content,post_tags,post_address,post_city,post_region,post_country,post_zip,IMAGE
42.2271049,-71.1782327,ExactMatch,Rooftop,100,Naturopaths,gd_place,published,Read Weaver Schusky,"I'm particularly good at educating my patients, about their current health conditions, and about treatment and prevention. I came into medicine strongly influenced by the women's self-care movement of the '70; I believe health care can be about giving people control over their bodies and their lives. While homeopathy is only one of the modalities I use, the skills needed to be a good homeopath, deeply understanding a patient, serve me (and my patients) well in whatever form of treatment we choose. One of the things I like best about being a naturopathic doctor is the wide range of options I have in treating my patients. Being able to choose among nutrition, herbal medicine, homeopathy, physical medicine, and counseling, as w
@jeffdeville
jeffdeville / 0002_sidekiq_initial.config
Created June 24, 2016 17:59
ElasticBeanstalk Sidekiq configuration
---
restart_sidekiq: &RESTART_SIDEKIQ
mode: "000755"
content: |
#!/bin/bash
initctl restart sidekiq || initctl start sidekiq
ln -sf /var/app/current/log/sidekiq.log /var/app/containerfiles/logs/sidekiq.log
mute_sidekiq: &MUTE_SIDEKIQ
mode: "000755"
content: |
@jeffdeville
jeffdeville / Gemfile.lock
Last active April 28, 2016 20:09
InfluxDB issues - ruby 2.2.0
GIT
remote: git://github.com/activeadmin/activeadmin.git
revision: d84f8190edac8c28f942cd4b6c3e16086da9d7a2
specs:
activeadmin (1.0.0.pre2)
arbre (~> 1.0, >= 1.0.2)
bourbon
coffee-rails
formtastic (~> 3.1)
formtastic_i18n
@jeffdeville
jeffdeville / receiver.rb
Created February 14, 2016 11:13
Sender / Receiver
require 'angelo'
require 'bunny'
Celluloid.logger = ::Logger.new(STDOUT)
module Receiver
class Server < Angelo::Base
get '/status' do
# TODO return number of incomplete tasks
# Look at self.class.server
@jeffdeville
jeffdeville / common.py
Created October 27, 2015 16:35
Decorating for python apis
def log(func):
@wraps(func)
def log_wrapper(func):
log_input(func.__name__, url, **new_kwargs)
try:
resp = func(url, **new_kwargs)
log_output(resp)
except Exception, e:
log_exception(e, resp)
raise e
{
"cloud_admin": "role:domain_admin and domain_id:default",
"service_or_admin": "role:admin or role:service_role",
"matching_domain_id": "domain_id:%(target.project.domain_id)s or domain_id:%(project.domain_id)s or domain_id:%(target.user.domain_id)s or domain_id:%(user.domain_id)s or domain_id:%(target.group.domain_id)s or domain_id:%(group.domain_id)s or domain_id:%(target.token.user.domain.id)s",
"matching_project_id": "project_id:%(scope.project.id)s or project_id:%(project_id)s)"
"matching_user_id": "user_id:%(user_id)s or user_id:%(target.token.user_id)s",
"owner" : "rule: matching_user_id"
"project_admin": "role:admin and rule:matching_project_id",
"project_member": "role:member and rule:matching_project_id",