Skip to content

Instantly share code, notes, and snippets.

View markhu's full-sized avatar
😅
having fun

Mark H markhu

😅
having fun
View GitHub Profile
#!/usr/bin/env python
# kafka-listen.py # optional args: -a for all, or regex pattern of topics
import datetime, json, os, sys
import kafka # pip install kafka-python
KAFKA_SERVER = "kafka-esque.servicebus.windows.net:9093"
KAFKA_TOPIC = "test-topic"
@markhu
markhu / server.py
Created December 8, 2020 18:36 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@markhu
markhu / AWStips.md
Last active October 29, 2018 20:40
test MarkDown formatting options for semi-complex document...

Excerpt from https://github.com/dwyl/learn-aws-lambda#hello-world-example-zip

  1. Zip up this file by typing the following into the command line. The command consists of the first filename which is the zip file you want to create (call it whatever you like .zip) followed by the files you want to zip up. In our example you can see the name of the .js file we created earlier:

        $ zip -r hello-world.zip hello-world.js

        You should now be able to see a .ZIP file alongside your .js file.
        NOTE: If your function has any dependencies then you must include your node_modules file within your .ZIP file. Simply add node_modules after the files you wish to zip up!


@markhu
markhu / keybase.md
Created March 16, 2018 06:08
Public Identity

Keybase proof

I hereby claim:

  • I am markhu on github.
  • I am markhu (https://keybase.io/markhu) on keybase.
  • I have a public key ASDHRT7joG_AT_MR5EVc3CJlLkhlC6qVt9ozQP08XT9sFwo

To claim this, I am signing this object:

@markhu
markhu / coin-performers.sh
Created January 23, 2018 22:48
finds best and worst cryptocurrency performers according to coinmarketcap.com
#!/bin/bash
# coin-performers.sh
# finds best and worst cryptocurrency performers according to coinmarketcap.com
# quick hacky bash script could use refactoring into Python or something...
window=${1:-"[1-9]+[dh]"}
now=$(date +%s)
# cache the top 100
@markhu
markhu / README.md
Last active April 5, 2017 18:40
Git oddly displayed red-background

Testing Git's code view odd red-background

@markhu
markhu / README.md
Last active March 24, 2016 16:45
meta-collections of files in Gist
  • If you have a README.md in your collection of Gist files, it will display first in your Gist user overview page https://gist.github.com/$USER
  • MarkDown formatting applies
  • Other files in the Gist are not displayed on your user overview.
@markhu
markhu / README.md
Last active February 3, 2021 14:39 — forked from rb2k/gist:8372402
Groovy jenkins scripts

Some of these Groovy scripts can be pasted into user jobs, and others require Admin script console access.

The low-diskspace was forked from someone else.

I made the multiAxis.groovy --though it seems so simple that it should be built in.

@markhu
markhu / edict.py
Last active August 15, 2023 11:54
edict: load JSON into Python object but access with .dot notation
class edict(dict): # Similar to bunch, but less, and JSON-centric
# based on class dotdict(dict): # from http://stackoverflow.com/questions/224026/dot-notation-for-dictionary-keys
__setattr__= dict.__setitem__ # TBD: support assignment of nested dicts by overriding this?
__delattr__= dict.__delitem__
def __init__(self, data):
if type(data) in ( unicode, str ):
data = json.loads( data)