This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
import tempfile | |
from time import time | |
import random | |
from os import listdir | |
from os.path import isfile, join | |
import pandas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from datetime import datetime | |
import alpaca_trade_api as tradeapi | |
import numpy as np | |
from positionhandling import positionHandler | |
import loader | |
api = tradeapi.REST() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For this example, we're going to write a simple momentum script. | |
# When the stock goes up quickly, we're going to buy; | |
# when it goes down we're going to sell. | |
# Hopefully we'll ride the waves. | |
from collections import deque | |
import math | |
import talib | |
atr = ta.ATR(timeperiod=20) # used to calculate 20-day ATR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "log" | |
import "net" | |
import "os" | |
var gaddr *net.UDPAddr = &net.UDPAddr{IP: net.IPv4(224, 0, 0, 254), Port: 12345} | |
func listener(c chan int) { | |
logger := log.New(os.Stdout, "[L]", log.Ltime | log.Lshortfile) | |
conn, err := net.ListenMulticastUDP("udp", nil, gaddr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROG = run | |
OBJS = main.o | |
all: $(PROG) | |
$(PROG): $(OBJS) | |
$(CC) -o $(PROG) $(OBJS) | |
clean: | |
rm -f $(PROG) $(OBJS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROG = run | |
OBJS = main.o | |
all: $(PROG) | |
$(PROG): $(OBJS) | |
$(CC) -o $(PROG) $(OBJS) | |
clean: | |
rm -f $(OBJS) $(PROG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do $$ declare declare begin for i in 1 .. 1000 loop execute 'create table myt' || i || '(check (id between ' || (i * 99) || ' and ' || (i * 100) || ' )) inherits(size_m)'; end loop; end; $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION=`pwd | perl -ne 's/.+postgresql-([^\/]+).*/$1/;print'` | |
./configure CC="ccache gcc" CFLAGS=-pthread --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert | |
# planner dev | |
#./configure OPTIMZER_DEBUG=1 CFLAGS=-pthread --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert | |
# mac | |
#./configure CC="ccache gcc" CFLAGS='-pthread -arch x86_64' --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert --with-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
base=$1 | |
version=$2 | |
if [ -z "$base" -o -z "$version" ] | |
then | |
echo "Usage $0 <base> <version>" | |
else | |
rm -f ~/local/$base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table size_m as select i as id, repeat(i::text, i % 100) as val from generate_series(1, 20000) i; | |
create table size_l as select i as id, m.id as m_id, repeat(i::text, i % 100) as val from generate_series(1, 1000000) i, size_m m where i.i / 10 = m.id; | |
--create index idx_m_id on size_l (m_id); | |
analyze size_m; | |
analyze size_l; | |
---- |