Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Building high-frequency trading signals in Python with Databento and sklearn
#
# This is a simple example that demonstrates how to build high-frequency trading signals in Python,
# using order book and market depth data from [Databento](https://databento.com) together with
# machine learning models from [sklearn](https://scikit-learn.org/).
import databento as db
import numpy as np
@freephys
freephys / pcap_udp.cpp
Created September 23, 2024 04:13 — forked from chrisaycock/pcap_udp.cpp
Example for accessing UDP packets in a pcap file
// answer to https://quant.stackexchange.com/q/55088/35
// compile with c++ pcap_udp.cpp -lpcap
#include <iostream>
#include <pcap/pcap.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
@freephys
freephys / search.py
Created May 4, 2022 04:41 — forked from selimslab/search.py
a search engine in 200 lines
import re
import math
import operator
import logging
from collections import defaultdict, Counter
import numpy as np
class Tokenizer:
def __init__(self, stop_words, ):
@freephys
freephys / github-clone-all.py
Created February 7, 2022 05:39 — forked from YuriyGuts/github-clone-all.py
Clone all public and private repositories from a specific GitHub user or organization
#!/usr/bin/env python
"""
Clone all public and private repositories from a GitHub user or organization.
Copyright (c) 2018 Yuriy Guts
usage: github-clone-all.py [-h] [--auth-user AUTH_USER]
[--auth-password AUTH_PASSWORD] [--clone-user USER]
[--clone-org ORG]
EasyLanguage Code To TesT The Predictability Of An Event
Vars:
Event(false),
FuturePrice(0),
I(0),
CG(0),
Denom(0);
Arrays:
PredictBin[100](0);
@freephys
freephys / useHexo.md
Created October 13, 2021 04:36 — forked from btfak/useHexo.md
How to use Hexo and deploy to GitHub Pages
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@freephys
freephys / airflow-python3.sh
Last active April 15, 2021 04:11 — forked from zacgx/airflow-python3.sh
Installing Airflow with CeleryExcuter, using PostgreSQL as metadata database and Redis for Celery message broker
# this script has been tested and worked in a freshly installed Ubuntu 16.04 and 16.10
# it assumes that you are running airflow in a private netowrk and no need to be worry about outside access
# if that's not the case, the lines for PostgreSQL and Redis in this script need to be updated accordingly
# run as root
sudo su
# initial system updates and installs
apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean
apt-get -y install build-essential binutils gcc make git htop nethogs tmux
@freephys
freephys / PyTorStemPrivoxy.md
Created September 24, 2020 02:39 — forked from KhepryQuixote/PyTorStemPrivoxy.md
Python script to connect to Tor via Stem and Privoxy, requesting a new connection (hence a new IP as well) as desired.

Crawling Anonymously with Tor in Python

adapted from the article "Crawling anonymously with Tor in Python" by S. Acharya, Nov 2, 2013.

The most common use-case is to be able to hide one's identity using TOR or being able to change identities programmatically, for example when you are crawling a website like Google and you don’t want to be rate-limited or blocked via IP address.

Tor

Install Tor.