Skip to content

Instantly share code, notes, and snippets.

View aregee's full-sized avatar
🎯
“continuously refactoring towards deeper insight”

Rahul Gaur aregee

🎯
“continuously refactoring towards deeper insight”
View GitHub Profile
@aregee
aregee / wolf.py
Created December 27, 2023 18:49
Scafolding for basic trading bot
import requests
import numpy as np
class MockExchangeAPI:
def get_latest_price(self, symbol):
# Mock function to get the latest price. Replace with actual API call.
return requests.get(f"https://api.exchange.com/latestPrice?symbol={symbol}").json()
def execute_trade(self, symbol, trade_type, quantity):
# Mock function to execute a trade. Replace with actual API call.
@aregee
aregee / zk-single-kafka-multiple.yml
Created September 30, 2022 18:50
Multinode Kafka for Local Development
version: '2.1'
services:
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- 8080:8080
depends_on:
- zoo1
@aregee
aregee / kafka-stack.yml
Created August 31, 2022 01:02
Kafka Docker stack multi broker and Web UI
version: '2.1'
services:
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- 8080:8080
depends_on:
- zoo1
@aregee
aregee / moverename.py
Last active September 22, 2020 17:38
import shutil
import os
import argparse
import datetime
import argparse
'''
on bash execute with --path to directory containing logs
$ python moverename.py --path <somepath>
#!/bin/bash
maxfilesperdir=20
# loop through all top level directories:
while IFS= read -r -d $'\0' topleveldir
do
# enter top level subdirectory:
cd "$topleveldir"
Scalr
http://highscalability.com/blog/2010/3/22/7-secrets-to-successfully-scaling-with-scalr-on-amazon-by-se.html
http://stackoverflow.com/questions/10061843/how-to-convert-linux-cron-jobs-to-the-amazon-way
Cron Jobs Are Hard To Distribute
Watch out when scaling out instances with cron jobs on them. Cron jobs aren't designed for the cloud. If the machine image holding your cron job scales out to 20 instances, your cron job will be executed 20 times more often.
This is fine if the scope of your cron job is limited to the instance itself, but if the scope is larger, the above becomes a serious problem. And if you single out a machine to run those cron jobs, you run the risk of not having it executed if that machine goes down.
header('λx.x') // Identity Function
// x => x
header('λx.λy.x+y')
// x => y => x + y
header('(λx.λy.x+y) 5 1')
// (x => y => x + y)(5)(1)
header('NUMBERS!')
// Counting is fun
header('0 := λfx.x')
@aregee
aregee / first.md
Created January 18, 2020 22:41 — forked from taxigy/first.md
Learning Clojure
layout title date categories crossposted
post
How I learned Clojure while solving easy coding challenges
2015-08-03
coding
logdown

I decided to learn Clojure (and therefore ClojureScript, since the two intersect significantly) by doing. Who'd ever blame me with that?

@aregee
aregee / dom.js
Last active November 28, 2018 12:28
Small functional wrapper over `document.createElement` to create elements in the following manner `dom.div(elAttrs={}, childrens=[])`
'use strict';
var DomApi = function DomApi(elements) {
/**
* Set attributes on giving element
* @param {object} attrs
* @param {HTMLElement} el
*/
function setAttrs(attrs, el) {
var uniqueId = Math.round(Math.random() * Date.now()).toString(20).substr(0, 4);

ES6 playground

ES6 (also known as Harmony) is the the next version of Javascript. Here's a few of the additions.

A Pen by Rahul Gaur on CodePen.

License.