Skip to content

Instantly share code, notes, and snippets.

View xaviergoby's full-sized avatar
💭
"Normality's a paved road: Comfy to walk, but no flowers grow in it"-V. Van Gogh

Alexander Xavier O'Rourke Goby xaviergoby

💭
"Normality's a paved road: Comfy to walk, but no flowers grow in it"-V. Van Gogh
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xaviergoby
xaviergoby / yahoo_finance.py
Created February 16, 2019 02:09 — forked from scrapehero/yahoo_finance.py
Python 3 code to extract stock market data from yahoo finance
from lxml import html
import requests
from time import sleep
import json
import argparse
from collections import OrderedDict
from time import sleep
def parse(ticker):
url = "http://finance.yahoo.com/quote/%s?p=%s"%(ticker,ticker)
@xaviergoby
xaviergoby / settings.py
Created December 27, 2018 03:37 — forked from nadya-p/settings.py
Simple Python settings class using JSON file as storage
import json
import os
class Settings:
_config_location = 'config.json'
def __init__(self):
if os.path.exists(self._config_location):
self.__dict__ = json.load(open(self._config_location))
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@wsvincent
wsvincent / admin.py
Created November 2, 2018 19:23
Django Custom User Model for any new project
# users/admin.py
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm, CustomUserChangeForm
from .models import CustomUser
class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
@yhilpisch
yhilpisch / 00_cqf_ml_elective.md
Last active February 11, 2024 23:13
Machine Learning for Finance | Dr. Yves J. Hilpisch | CQF Elective | London, 23. May 2017

Machine Learning for Finance

A CQF elective with Dr. Yves J. Hilpisch, The Python Quants GmbH

General resources:

@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active June 30, 2024 04:50
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@dnmellen
dnmellen / test_views.py
Last active May 29, 2023 13:31
How to create a unittest for a "View" Mixin (Django Testing)
from django.test import TestCase, RequestFactory
from django.views.generic import TemplateView
from ..lib.views import YourMixin
class YourMixinTest(TestCase):
'''
Tests context-data in a Django Mixin like a boss
'''
@maraujop
maraujop / forms.py
Created February 15, 2012 19:04
django-crispy-forms bootstrap form example
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
@jacobian
jacobian / models.py
Created February 15, 2011 18:11
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
def __unicode__(self):