Skip to content

Instantly share code, notes, and snippets.

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

Ananth Sounder ultrasounder

🏠
Working from home
View GitHub Profile
@ultrasounder
ultrasounder / cheatsheet.sol
Created December 3, 2021 07:00 — forked from patrickd-/cheatsheet.md
Solidity – Compilable Cheatsheet
// SPDX-License-Identifier: MIT
// ^ recommended, included machine readable in bytecode metadata
// Software Package Data Exchange is an open standard
pragma solidity ^0.8.7;
// ^ floating pragma, min 0.8.7 max excluding 0.9.0
// same as complex pragma: pragma solidity >=0.8.7 <0.9.0;
// major.breakingchanges.bugfixes
// only makes the compiler check for compatibility and throws error if not matching!
// should only be floating during development, fixed everywhere during testing & deployment

Introduction

This gist started with a collection of resources I was maintaining on stream data processing — also known as distributed logs, data pipelines, event sourcing, CQRS, and other names.

Over time the set of resources grew quite large and I received some interest in a more guided, opinionated path for learning about stream data processing. So I added the reading list.

Please send me feedback!

@ultrasounder
ultrasounder / spacy_intro.ipynb
Created September 11, 2022 20:00 — forked from aparrish/spacy_intro.ipynb
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ultrasounder
ultrasounder / extract_data.py
Created September 24, 2022 06:21 — forked from bkaankuguoglu/extract_data.py
This program extracts regular expressions within the given frame on a set of documents.
#=======================================================================#
# extract_data.py #
#=======================================================================#
# usage: extract_data.py [-h] [-i INPUT_DIR] [-o OUTPUT_DIR]
#
# This program extracts provision numbers from a set of documents.
#
# optional arguments:
# -h, --help show this help message and exit
# -i INPUT_DIR, --input_dir INPUT_DIR
@ultrasounder
ultrasounder / map.py
Created September 25, 2022 21:23 — forked from ajschumacher/map.py
Calculates the Mean Average Precision, as in: http://www.kaggle.com/c/FacebookRecruiting/details/Evaluation
#!/usr/bin/env python
import sys
import csv
def MeanAveragePrecision(valid_filename, attempt_filename, at=10):
at = int(at)
valid = dict()
for line in csv.DictReader(open(valid_filename,'r')):
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" "))
# 17 list comprehension problems in python
fruits = ['mango', 'kiwi', 'strawberry', 'guava', 'pineapple', 'mandarin orange']
numbers = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 23, 256, -8, -4, -2, 5, -9]
# Example for loop solution to add 1 to each number in the list
numbers_plus_one = []
for number in numbers:
numbers_plus_one.append(number + 1)
@ultrasounder
ultrasounder / beautiful_idiomatic_python.md
Created October 3, 2022 01:59 — forked from 0x4D31/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@ultrasounder
ultrasounder / lc-practice.py
Created October 3, 2022 04:17 — forked from doughsay/lc-practice.py
Python List Comprehension Practice Problems
def identity(nums):
"""Identity:
Given a list of numbers, write a list comprehension that produces a copy of the list.
>>> identity([1, 2, 3, 4, 5])
[1, 2, 3, 4, 5]
>>> identity([])
[]
@ultrasounder
ultrasounder / readserial.py
Created October 11, 2022 20:58 — forked from andypiper/readserial.py
Scrape serial port for text data and publish on MQTT
#!/usr/bin/python
#
#simple app to read string from serial port
#and publish via MQTT
#
#uses the Python MQTT client from the Mosquitto project
#http://mosquitto.org
#
#Andy Piper http://andypiper.co.uk
#2011/09/15