Skip to content

Instantly share code, notes, and snippets.

Avatar

eabase

  • Between the radio ether and you.
View GitHub Profile
@eabase
eabase / HelloSDL2.cpp
Last active May 18, 2021
A minimal Hello World C++ example for using SDL2 to render text in a native Windows window.
View HelloSDL2.cpp
//---------------------------------------------------------------------
// Name: HelloSDL2.cpp
// Author: EAML
// Date: 2021-05-16
//
// Description:
// A minimal PoC for producing a native SDL2 Windows app that can
// be ran from either Windows Explorer or from Powershell console.
// It's designed to use minimal command line, compiler options,
// and dependencies... It will display a gray window for 2 sec's.
@eabase
eabase / pg-pong.py
Created May 15, 2021 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
View pg-pong.py
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@eabase
eabase / metatrader5_live.py
Created May 15, 2021 — forked from sharavsambuu/metatrader5_live.py
Template for live algo with MetaTrader5 and Python
View metatrader5_live.py
# References :
# - https://stackoverflow.com/questions/61776425/logic-for-real-time-algo-trading-expert
import pytz
import pandas as pd
import MetaTrader5 as mt5
import time
from datetime import datetime
from threading import Timer
@eabase
eabase / pip-search.py
Created Dec 18, 2020
pip search removed - The Return (How hard can it be?)
View pip-search.py
# Basic pip search function provided by:
# https://pypi.org/project/pip-search/
import sys
from urllib import request
from tabulate import tabulate
def search () :
f = request.urlopen('https://pypi.org/search/?q=%s' % sys.argv[1])
raw_text=str(f.read())
View dlib and face_recognition on raspberry pi.md

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

@eabase
eabase / socks.md
Created Nov 27, 2020 — forked from rwb27/socks.md
Internet access for a Raspberry Pi on a hidden network
View socks.md

Setting up a SOCKS proxy on a Raspberry Pi

My problem: I have a bunch of Raspberry Pi computers, all connected via a network switch and USB ethernet port to a "gateway" Raspberry Pi. However, I don't particularly want them all to be internet-connected all of the time, because (1) it's possible there is a slight security risk and (2) my IT folk at work might not like it. OK, I should also mention (3) I tried and failed to get NAT and dnsmasq to work, and don't have time to finish debugging it.

My solution: I SSH in to my "gateway" Pi (is it ok to call it a gateway even though it's resolutely failing to route any traffic? Never mind...), and from there I can connect to my hidden Pi(s), let's say for arguments sake it's called hiddenpi.local.

ssh pi@hiddenpi.local

Now, I can SSH back again, setting up a SOCKS proxy:

@eabase
eabase / Out-HostColored.ps1
Created Nov 24, 2020 — forked from mklement0/Out-HostColored.ps1
PowerShell function that colors portions of the default host output that match given patterns.
View Out-HostColored.ps1
<#
Prerequisites: PowerShell version 2 or above.
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD, from PowerShell version 3 or above:
irm https://gist.github.com/mklement0/243ea8297e7db0e1c03a67ce4b1e765d/raw/Out-HostColored.ps1 | iex
@eabase
eabase / github_markdown_emojis.md
Last active Nov 14, 2020
Complete list of github markdown emojis
View github_markdown_emojis.md

People

emo emo emo
:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😀 :grinning:
@eabase
eabase / GitHub_Collapsible_Content.md
Created Nov 11, 2020
GitHub Collapsible Content
View GitHub_Collapsible_Content.md

Examples of Collapsible Content

Style 1

Click to see more:
Given the following python code
from pychartjs import BaseChart

class myChart(BaseChart):
    pass
@eabase
eabase / MemoryAllocationHFT.cpp
Created Oct 23, 2020 — forked from silahian/MemoryAllocationHFT.cpp
Pre allocated vs dynamic arrays performance for low latency / high frequency trading systems
View MemoryAllocationHFT.cpp
// Example program
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
// ***********************************
// This is for measuring CPU clocks
#if defined(__i386__)
static __inline__ unsigned long long rdtsc(void)