Skip to content

Instantly share code, notes, and snippets.

@ademidun
ademidun / solana-bear-case.md
Created January 6, 2022 16:52
Some thoughts on why I think Solana is overvalued
@ademidun
ademidun / data_loader.py
Created June 18, 2021 23:44
Load data from an external file and save to a database in Django and add some tests to the data loader functionality.
import csv
import gspread
from django.db.models import BooleanField
from google.oauth2.service_account import Credentials
from django.contrib.postgres.fields import ArrayField
from contact.models import Contact
@ademidun
ademidun / createTableOfContents.js
Last active March 16, 2022 16:37
Dynamically create table of contents using headings on a given page.
/**
*
* @param parentSelector: Where to insert the new table of contents.
* Leave blank if you only wnat to return the table of contents without
* automatically prepending to the parent component.
* @see: https://css-tricks.com/automatic-table-of-contents/
* @see: Used in https://atila.ca/blog/tomiwa/how-to-embed-a-notion-page-in-a-react-website/
*/
export function createTableOfContents(parentSelector="") {
@ademidun
ademidun / execute_trade.py
Created December 4, 2020 21:24
Austrian quant code snippet
def execute_trade(context,data):
"""
Execute orders according to our schedule_function() timing.
Part of the Austrian Quant blog post: https://blog.tomiwa.ca/austrian-quant/
Control + F "wordpress" to find the relevant part in the blog post.
"""
prices = data.history(assets = context.stocks, bar_count = context.historical_bars, frequency='1d', fields='price')
for stock in context.stocks:
@ademidun
ademidun / useful-javascript-utils.js
Created August 5, 2020 20:33
Useful javascript utility functions to make your life easier.
function prettifyKeys(rawKey) {
return toTitleCase(rawKey.replace(/_/g, ' ' ));
}
function toTitleCase(str) {
var i, j, lowers, uppers;
str = str.replace(/([^\W_]+[^\s-]*) */g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
@ademidun
ademidun / speculation_fund.py
Last active June 10, 2020 15:17
Austrian quant code snippet
"""
This is a template algorithm on Quantopian for you to adapt and fill in.
@author: Tomiwa Ademidun
@souce: https://github.com/ademidun/austrian-quant/blob/89593c86935ce08937aca79347902a7f93dee279/quantopian/speculation_fund.py
"""
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC, LinearSVC, NuSVC
from sklearn.ensemble import RandomForestClassifier
@ademidun
ademidun / django-cloud-9.md
Last active September 26, 2020 19:08
Set up Django on Cloud 9 or Fedora
@ademidun
ademidun / how-to-make-website.js
Created May 3, 2020 20:53
Code samples from my How to Make a website tutorial
setTimeout( () => {
$( "#name-title" ).html( "<h1>🔥</h1>" );
}, 2000);
@ademidun
ademidun / aws-secrets-manager-code-sample.py
Created April 11, 2020 13:40
Sample code View a code sample that illustrates how to retrieve the secret in your application.
# Use this code snippet in your app.
# If you need more information about configurations or implementing the sample code, visit the AWS docs:
# https://aws.amazon.com/developers/getting-started/python/
import boto3
import base64
from botocore.exceptions import ClientError
def get_secret():