Skip to content

Instantly share code, notes, and snippets.

View zjhmale's full-sized avatar
🏠
Working from home

xxx zjhmale

🏠
Working from home
View GitHub Profile
@zjhmale
zjhmale / Bot.py
Created July 16, 2021 14:55 — forked from guiziyu/Bot.py
Elon Musk Twitter Trading Bot
import time
import os, io
import urllib.request
import tweepy
from google.cloud import vision
from google.cloud import vision_v1
import urllib.parse, urllib.request
import hashlib, hmac, time
import requests
/**
* Use this file to configure your truffle project. It's seeded with some
* common settings for different networks and features like migrations,
* compilation and testing. Uncomment the ones you need or modify
* them to suit your project as necessary.
*
* More information about configuration can be found at:
*
* truffleframework.com/docs/advanced/configuration
*
@zjhmale
zjhmale / waitgroup.py
Created April 25, 2020 07:28
Python WaitGroup (like Go sync.WaitGroup)
import threading # :(
class WaitGroup(object):
"""WaitGroup is like Go sync.WaitGroup.
Without all the useful corner cases.
"""
def __init__(self):
self.count = 0
self.cv = threading.Condition()
@zjhmale
zjhmale / channel.cpp
Created March 24, 2020 10:30 — forked from vmrob/channel.cpp
Go channels in C++
#include <future>
#include <iostream>
#include <thread>
#include <queue>
template <typename T>
class concurrent_queue {
private:
std::queue<T> _queue;
std::mutex _mutex;
@zjhmale
zjhmale / values_pointers.go
Created February 19, 2020 20:53 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@zjhmale
zjhmale / ema.py
Created January 24, 2020 06:32
display infinite and finite ema
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from finta import TA
if __name__ == '__main__':
ts = pd.date_range('1/1/2000', periods=100)
price = pd.DataFrame(np.random.randn(100, 1), index=ts, columns=['close'])
@zjhmale
zjhmale / ema.py
Created January 24, 2020 06:32
display infinite and finite ema
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from finta import TA
if __name__ == '__main__':
ts = pd.date_range('1/1/2000', periods=100)
price = pd.DataFrame(np.random.randn(100, 1), index=ts, columns=['close'])
@zjhmale
zjhmale / gist:b133f0f53ad4981a3ba520cee68e8f3e
Created November 11, 2019 16:28 — forked from zbroyar/gist:1432555
OCaml CURL GET, POST, PUT, DELETE examples
(* ocamlfind ocamlopt -o exmpl -package curl -linkpkg exmpl.ml *)
open Printf
let _ = Curl.global_init Curl.CURLINIT_GLOBALALL
(*
*************************************************************************
** Aux. functions
*************************************************************************
*)
@zjhmale
zjhmale / maybe.py
Created October 30, 2019 06:45 — forked from senko/maybe.py
A Pythonic implementation of the Maybe monad
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@zjhmale
zjhmale / xxfx.zsh-theme
Created December 13, 2018 03:36
customized xxf zsh theme
# Copy and self modified from ys.zsh-theme, the one of default themes in master repository
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
# http://xiaofan.at
# 2 Jul 2015 - Xiaofan
# Machine name.
function box_name {