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 / 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 / main.cpp
Created October 21, 2017 17:01 — forked from brotchie/main.cpp
Minimal C++ implementation of Functor, Monad and Maybe using c++0x variadic templates and lambda expressions.
/*
* Minimal C++ implementation of Functor, Monad and Maybe.
*
* Requires c++0x variadic templates and lambda expressions:
*
* g++ -std=c++0x main.cpp -o main
*
* fmap, monadic bind and return implementations for std::vector
* and Maybe.
*
@zjhmale
zjhmale / spacemacs_hint.md
Created October 2, 2017 08:08 — forked from ivar/spacemacs global search and replace.md
spacemacs - global search and replace

There's a couple of ways, one way is

  • Get search results
    • Do SPC / and type in your search string
    • or SPC x S and search string - where x is your scope indicator (p for project, d for directory, etc..)
  • Once you have the occurences you want, hit C-c C-e inside the helm buffer to put all your match occurences and puts them into a special buffer called the edit buffer or something like that
  • in that buffer you can use any commands you'd normally use on a buffer
  • the C-c C-c to commit your changes.
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Language.Brainfuck.Parser
(parse)
where
import Control.Monad.Except
import Control.Monad.State
data ParseError = Unexpected Char