Skip to content

Instantly share code, notes, and snippets.

@rowe-morehouse
rowe-morehouse / ai-writing-tools.md
Last active June 4, 2024 19:25
🔥 List of AI Writing Tools: AI Writing Assistant, AI Chat, Automatic Content Generation, Idea Recommendation, Paraphrasing, Summarizing, Outlining, SEO Metas, Grammar Check, Tone Check, Sales Email Customization
@dragosthealex
dragosthealex / historical_nasdaq_ticker.py
Last active September 28, 2021 12:14
Get historical daily data from NASDAQ by ticker
import requests
import json
import pandas as pd
import datetime
def get_from_nasdaq(ticker, date_from=None, date_to=None) -> pd.DataFrame:
"""Return historical daily data for ticker from NASDAQ
Args:
@ranaroussi
ranaroussi / nasdaq_premarket.py
Last active November 18, 2021 20:18
gets premarket prices from nasdaq
import requests
def get_premarket(ticker):
"""
gets premarket prices from nasdaq
usage:
>> price, volume = get_premarket('spy')
"""
@anshoomehra
anshoomehra / parsing10k.ipynb
Last active September 7, 2024 01:15
How to Parse 10-K Report from EDGAR (SEC)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yossisp
yossisp / Dockerfile-prod1
Last active March 1, 2024 00:29
nginx setup for multiple docker-compose containers (react.js app, node.js server)
# Dockerfile for react.js app and nginx
# build environment
FROM node:8-alpine as builder
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
RUN npm install
COPY . /usr/src/app
RUN npm run build --loglevel verbose
@valferon
valferon / postgres_manager.py
Created March 29, 2018 02:35
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@ricjcosme
ricjcosme / dump-restore
Created September 13, 2017 17:33
DUMP / RESTORE PostgreSQL Kubernetes
DUMP
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] [database-name]" > database.sql
RESTORE
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
@PetrochukM
PetrochukM / subword_text_tokenizer.py
Last active July 8, 2021 23:53
Tensor2Tensor Subword Text Tokenizer.
# coding=utf-8
# Copyright 2017 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@Tushar-N
Tushar-N / pad_packed_demo.py
Last active August 7, 2024 06:17
How to use pad_packed_sequence in pytorch<1.1.0
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
seqs = ['gigantic_string','tiny_str','medium_str']
# make <pad> idx 0
vocab = ['<pad>'] + sorted(set(''.join(seqs)))
# make model
@urschrei
urschrei / png_to_polygon_to_geojson.py
Last active November 16, 2022 16:58
Read a PNG into a numpy array, convert it to a Shapely Polygon, and dump it as GeoJSON
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by Stephan Hügel on 2017-03-02
The MIT License (MIT)
Copyright (c) 2017 Stephan Hügel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell